mirror of
https://github.com/discourse/discourse.git
synced 2025-05-23 09:31:13 +08:00
remove trailing whitespaces ❤️
This commit is contained in:
@ -44,7 +44,7 @@ describe TopicsController do
|
||||
|
||||
it "has a url" do
|
||||
::JSON.parse(response.body)['url'].should be_present
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
context 'failure' do
|
||||
@ -67,7 +67,7 @@ describe TopicsController do
|
||||
::JSON.parse(response.body)['url'].should be_blank
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
@ -96,7 +96,7 @@ describe TopicsController do
|
||||
end
|
||||
|
||||
it 'requires the enabled parameter' do
|
||||
lambda { xhr :put, :status, topic_id: @topic.id, status: 'visible' }.should raise_error(Discourse::InvalidParameters)
|
||||
lambda { xhr :put, :status, topic_id: @topic.id, status: 'visible' }.should raise_error(Discourse::InvalidParameters)
|
||||
end
|
||||
|
||||
it 'raises an error with a status not in the whitelist' do
|
||||
@ -132,7 +132,7 @@ describe TopicsController do
|
||||
|
||||
it 'deletes the forum topic user record' do
|
||||
PostTiming.expects(:destroy_for).with(@user.id, @topic.id)
|
||||
xhr :delete, :destroy_timings, topic_id: @topic.id
|
||||
xhr :delete, :destroy_timings, topic_id: @topic.id
|
||||
end
|
||||
|
||||
end
|
||||
@ -140,7 +140,7 @@ describe TopicsController do
|
||||
end
|
||||
|
||||
|
||||
describe 'mute/unmute' do
|
||||
describe 'mute/unmute' do
|
||||
|
||||
it 'needs you to be logged in' do
|
||||
lambda { xhr :put, :mute, topic_id: 99}.should raise_error(Discourse::NotLoggedIn)
|
||||
@ -150,7 +150,7 @@ describe TopicsController do
|
||||
lambda { xhr :put, :unmute, topic_id: 99}.should raise_error(Discourse::NotLoggedIn)
|
||||
end
|
||||
|
||||
describe 'when logged in' do
|
||||
describe 'when logged in' do
|
||||
before do
|
||||
@topic = Fabricate(:topic, user: log_in)
|
||||
end
|
||||
@ -158,12 +158,12 @@ describe TopicsController do
|
||||
it "changes the user's starred flag when the parameter is present" do
|
||||
Topic.any_instance.expects(:toggle_mute).with(@topic.user, true)
|
||||
xhr :put, :mute, topic_id: @topic.id, starred: 'true'
|
||||
end
|
||||
end
|
||||
|
||||
it "removes the user's starred flag when the parameter is not true" do
|
||||
Topic.any_instance.expects(:toggle_mute).with(@topic.user, false)
|
||||
xhr :put, :unmute, topic_id: @topic.id, starred: 'false'
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
@ -182,20 +182,20 @@ describe TopicsController do
|
||||
|
||||
it "ensures the user can see the topic" do
|
||||
Guardian.any_instance.expects(:can_see?).with(@topic).returns(false)
|
||||
xhr :put, :star, topic_id: @topic.id, starred: 'true'
|
||||
xhr :put, :star, topic_id: @topic.id, starred: 'true'
|
||||
response.should be_forbidden
|
||||
end
|
||||
|
||||
it "changes the user's starred flag when the parameter is present" do
|
||||
Topic.any_instance.expects(:toggle_star).with(@topic.user, true)
|
||||
xhr :put, :star, topic_id: @topic.id, starred: 'true'
|
||||
end
|
||||
end
|
||||
|
||||
it "removes the user's starred flag when the parameter is not true" do
|
||||
Topic.any_instance.expects(:toggle_star).with(@topic.user, false)
|
||||
xhr :put, :star, topic_id: @topic.id, starred: 'false'
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
describe 'delete' do
|
||||
@ -213,7 +213,7 @@ describe TopicsController do
|
||||
Guardian.any_instance.expects(:can_delete?).with(@topic).returns(false)
|
||||
xhr :delete, :destroy, id: @topic.id
|
||||
response.should be_forbidden
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
describe 'with permission' do
|
||||
@ -236,7 +236,7 @@ describe TopicsController do
|
||||
end
|
||||
end
|
||||
|
||||
describe 'show' do
|
||||
describe 'show' do
|
||||
|
||||
let(:topic) { Fabricate(:post).topic }
|
||||
let!(:p1) { Fabricate(:post, user: topic.user) }
|
||||
@ -251,7 +251,7 @@ describe TopicsController do
|
||||
lambda { xhr :get, :show, id: topic.id }.should change(View, :count).by(1)
|
||||
end
|
||||
|
||||
it 'tracks a visit for all html requests' do
|
||||
it 'tracks a visit for all html requests' do
|
||||
current_user = log_in(:coding_horror)
|
||||
TopicUser.expects(:track_visit!).with(topic, current_user)
|
||||
get :show, id: topic.id
|
||||
@ -293,7 +293,7 @@ describe TopicsController do
|
||||
it 'delegates a posts_before param to TopicView#filter_posts_before' do
|
||||
TopicView.any_instance.expects(:filter_posts_before).with(p2.post_number)
|
||||
xhr :get, :show, id: topic.id, posts_before: p2.post_number
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
@ -314,7 +314,7 @@ describe TopicsController do
|
||||
Guardian.any_instance.expects(:can_edit?).with(@topic).returns(false)
|
||||
xhr :put, :update, topic_id: @topic.id, slug: @topic.title
|
||||
response.should be_forbidden
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
describe 'with permission' do
|
||||
@ -345,7 +345,7 @@ describe TopicsController do
|
||||
describe 'invite' do
|
||||
it "won't allow us to invite toa topic when we're not logged in" do
|
||||
lambda { xhr :post, :invite, topic_id: 1, email: 'jake@adventuretime.ooo' }.should raise_error(Discourse::NotLoggedIn)
|
||||
end
|
||||
end
|
||||
|
||||
describe 'when logged in' do
|
||||
before do
|
||||
@ -361,7 +361,7 @@ describe TopicsController do
|
||||
Guardian.any_instance.expects(:can_invite_to?).with(@topic).returns(false)
|
||||
xhr :post, :invite, topic_id: @topic.id, user: 'jake@adventuretime.ooo'
|
||||
response.should be_forbidden
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
describe 'with permission' do
|
||||
@ -382,7 +382,7 @@ describe TopicsController do
|
||||
|
||||
it 'returns success JSON' do
|
||||
::JSON.parse(response.body).should == {'success' => 'OK'}
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
context 'when it fails and returns nil' do
|
||||
@ -398,7 +398,7 @@ describe TopicsController do
|
||||
|
||||
it 'returns success JSON' do
|
||||
::JSON.parse(response.body).should == {'failed' => 'FAILED'}
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
|
Reference in New Issue
Block a user