mirror of
https://github.com/discourse/discourse-chat-integration.git
synced 2025-03-09 14:35:34 +00:00
correct specs
This commit is contained in:
parent
805cd762df
commit
3069124273
@ -48,8 +48,8 @@ describe 'Mattermost Command Controller', type: :request do
|
||||
|
||||
describe 'when the token is invalid' do
|
||||
it 'should raise the right error' do
|
||||
expect { post '/chat-integration/mattermost/command.json', params: { text: 'help' } }
|
||||
.to raise_error(ActionController::ParameterMissing)
|
||||
post '/chat-integration/mattermost/command.json', params: { text: 'help' }
|
||||
expect(response.status).to eq(400)
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -20,14 +20,16 @@ describe 'Chat Controller', type: :request do
|
||||
shared_examples 'admin constraints' do |action, route|
|
||||
context 'when user is not signed in' do
|
||||
it 'should raise the right error' do
|
||||
expect { public_send(action, route) }.to raise_error(ActionController::RoutingError)
|
||||
public_send(action, route)
|
||||
expect(response.status).to eq(404)
|
||||
end
|
||||
end
|
||||
|
||||
context 'when user is not an admin' do
|
||||
it 'should raise the right error' do
|
||||
sign_in(Fabricate(:user))
|
||||
expect { public_send(action, route) }.to raise_error(ActionController::RoutingError)
|
||||
public_send(action, route)
|
||||
expect(response.status).to eq(404)
|
||||
end
|
||||
end
|
||||
end
|
||||
@ -73,7 +75,7 @@ describe 'Chat Controller', type: :request do
|
||||
|
||||
expect(response).to be_success
|
||||
|
||||
json = JSON.parse(response.body)
|
||||
JSON.parse(response.body)
|
||||
end
|
||||
|
||||
it 'should fail for invalid channel' do
|
||||
@ -120,9 +122,8 @@ describe 'Chat Controller', type: :request do
|
||||
end
|
||||
|
||||
it 'should fail for invalid provider' do
|
||||
expect do
|
||||
get '/admin/plugins/chat/channels.json', params: { provider: 'someprovider' }
|
||||
end.to raise_error(Discourse::InvalidParameters)
|
||||
get '/admin/plugins/chat/channels.json', params: { provider: 'someprovider' }
|
||||
expect(response.status).to eq(400)
|
||||
end
|
||||
|
||||
end
|
||||
|
Loading…
x
Reference in New Issue
Block a user