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

@ -84,6 +84,28 @@ describe TopicsController do
end
describe "print" do
render_views
context "when the SiteSetting is enabled" do
before do
SiteSetting.stubs(:max_prints_per_hour_per_user).returns(10)
end
it "uses the application layout when there's no param" do
get :show, topic_id: topic.id, slug: topic.slug
expect(response).to render_template(layout: 'application')
assert_select "meta[name=fragment]", true, "it has the meta tag"
end
it "uses the crawler layout when there's an print param" do
get :show, topic_id: topic.id, slug: topic.slug, print: 'true'
expect(response).to render_template(layout: 'crawler')
assert_select "meta[name=fragment]", false, "it doesn't have the meta tag"
end
end
end
describe 'clear_notifications' do
it 'correctly clears notifications if specified via cookie' do
notification = Fabricate(:notification)