mirror of
https://github.com/discourse/discourse.git
synced 2025-05-22 07:53:49 +08:00
Add tests
This commit is contained in:
@ -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 }
|
||||
|
Reference in New Issue
Block a user