mirror of
https://github.com/discourse/discourse.git
synced 2025-01-18 10:42:45 +08:00
correct plugin specs
This commit is contained in:
parent
49ed382c2a
commit
7e3543d96f
|
@ -28,8 +28,8 @@ describe "Discobot Certificate" do
|
|||
}
|
||||
|
||||
params.each do |key, _|
|
||||
expect { get '/discobot/certificate.svg', params: params.except(key) }
|
||||
.to raise_error(Discourse::InvalidParameters)
|
||||
get '/discobot/certificate.svg', params: params.except(key)
|
||||
expect(response.status).to eq(400)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -23,7 +23,8 @@ describe ::Presence::PresencesController do
|
|||
|
||||
context 'when not logged in' do
|
||||
it 'should raise the right error' do
|
||||
expect { post '/presence/publish.json' }.to raise_error(Discourse::NotLoggedIn)
|
||||
post '/presence/publish.json'
|
||||
expect(response.status).to eq(403)
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -57,34 +57,34 @@ describe "DiscoursePoll endpoints" do
|
|||
|
||||
describe 'when post_id is blank' do
|
||||
it 'should raise the right error' do
|
||||
expect { get "/polls/voters.json", params: { poll_name: DiscoursePoll::DEFAULT_POLL_NAME } }
|
||||
.to raise_error(ActionController::ParameterMissing)
|
||||
get "/polls/voters.json", params: { poll_name: DiscoursePoll::DEFAULT_POLL_NAME }
|
||||
expect(response.status).to eq(400)
|
||||
end
|
||||
end
|
||||
|
||||
describe 'when post_id is not valid' do
|
||||
it 'should raise the right error' do
|
||||
expect do
|
||||
get "/polls/voters.json", params: {
|
||||
post_id: -1,
|
||||
poll_name: DiscoursePoll::DEFAULT_POLL_NAME
|
||||
}
|
||||
end.to raise_error(Discourse::InvalidParameters, 'post_id is invalid')
|
||||
get "/polls/voters.json", params: {
|
||||
post_id: -1,
|
||||
poll_name: DiscoursePoll::DEFAULT_POLL_NAME
|
||||
}
|
||||
expect(response.status).to eq(400)
|
||||
expect(response.body).to include('post_id is invalid')
|
||||
end
|
||||
end
|
||||
|
||||
describe 'when poll_name is blank' do
|
||||
it 'should raise the right error' do
|
||||
expect { get "/polls/voters.json", params: { post_id: post.id } }
|
||||
.to raise_error(ActionController::ParameterMissing)
|
||||
get "/polls/voters.json", params: { post_id: post.id }
|
||||
expect(response.status).to eq(400)
|
||||
end
|
||||
end
|
||||
|
||||
describe 'when poll_name is not valid' do
|
||||
it 'should raise the right error' do
|
||||
expect do
|
||||
get "/polls/voters.json", params: { post_id: post.id, poll_name: 'wrongpoll' }
|
||||
end.to raise_error(Discourse::InvalidParameters, 'poll_name is invalid')
|
||||
get "/polls/voters.json", params: { post_id: post.id, poll_name: 'wrongpoll' }
|
||||
expect(response.status).to eq(400)
|
||||
expect(response.body).to include('poll_name is invalid')
|
||||
end
|
||||
end
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user