Add tests

This commit is contained in:
Rafael dos Santos Silva
2016-08-07 20:01:23 -03:00
parent 2a5a0bebb3
commit f96fffeb34
3 changed files with 43 additions and 0 deletions

View File

@ -747,6 +747,22 @@ describe TopicsController do
expect(IncomingLink.count).to eq(1)
end
it "doesn't renders the print view by default" do
user = Fabricate(:user)
get :show, topic_id: topic.id, slug: topic.slug, print: true
expect(response).to be_forbidden
end
it 'renders the print view when enabled' do
SiteSetting.max_prints_per_hour_per_user = 10
user = Fabricate(:user)
get :show, topic_id: topic.id, slug: topic.slug, print: true
expect(response).to be_successful
end
it 'records redirects' do
@request.env['HTTP_REFERER'] = 'http://twitter.com'
get :show, { id: topic.id }