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
|
describe 'when the token is invalid' do
|
||||||
it 'should raise the right error' do
|
it 'should raise the right error' do
|
||||||
expect { post '/chat-integration/mattermost/command.json', params: { text: 'help' } }
|
post '/chat-integration/mattermost/command.json', params: { text: 'help' }
|
||||||
.to raise_error(ActionController::ParameterMissing)
|
expect(response.status).to eq(400)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -20,14 +20,16 @@ describe 'Chat Controller', type: :request do
|
|||||||
shared_examples 'admin constraints' do |action, route|
|
shared_examples 'admin constraints' do |action, route|
|
||||||
context 'when user is not signed in' do
|
context 'when user is not signed in' do
|
||||||
it 'should raise the right error' 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
|
||||||
end
|
end
|
||||||
|
|
||||||
context 'when user is not an admin' do
|
context 'when user is not an admin' do
|
||||||
it 'should raise the right error' do
|
it 'should raise the right error' do
|
||||||
sign_in(Fabricate(:user))
|
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
|
end
|
||||||
end
|
end
|
||||||
@ -73,7 +75,7 @@ describe 'Chat Controller', type: :request do
|
|||||||
|
|
||||||
expect(response).to be_success
|
expect(response).to be_success
|
||||||
|
|
||||||
json = JSON.parse(response.body)
|
JSON.parse(response.body)
|
||||||
end
|
end
|
||||||
|
|
||||||
it 'should fail for invalid channel' do
|
it 'should fail for invalid channel' do
|
||||||
@ -120,9 +122,8 @@ describe 'Chat Controller', type: :request do
|
|||||||
end
|
end
|
||||||
|
|
||||||
it 'should fail for invalid provider' do
|
it 'should fail for invalid provider' do
|
||||||
expect do
|
get '/admin/plugins/chat/channels.json', params: { provider: 'someprovider' }
|
||||||
get '/admin/plugins/chat/channels.json', params: { provider: 'someprovider' }
|
expect(response.status).to eq(400)
|
||||||
end.to raise_error(Discourse::InvalidParameters)
|
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
Loading…
x
Reference in New Issue
Block a user