diff options
author | Kamil Trzciński <ayufan@ayufan.eu> | 2017-01-31 11:40:27 +0000 |
---|---|---|
committer | Kamil Trzciński <ayufan@ayufan.eu> | 2017-01-31 11:40:27 +0000 |
commit | e4bcdddfa79d855e7f320a8d91e79e17d2e1bf5f (patch) | |
tree | 773ec4112b83aed98c1c4faefd1b0f60e2640d7c /spec | |
parent | 223f1f3d2dd95d6b87a485ce0df6f4fef77eb522 (diff) | |
parent | bd5245dba67b4aa4fccce819e4491259d568240b (diff) | |
download | gitlab-ce-e4bcdddfa79d855e7f320a8d91e79e17d2e1bf5f.tar.gz |
Merge branch 'zj-display-error-team-fetch' into 'master'
Fix inconsistent return type
Closes #27150
See merge request !8290
Diffstat (limited to 'spec')
3 files changed, 12 insertions, 6 deletions
diff --git a/spec/controllers/projects/mattermosts_controller_spec.rb b/spec/controllers/projects/mattermosts_controller_spec.rb index 2ae635a1244..cae733f0cfb 100644 --- a/spec/controllers/projects/mattermosts_controller_spec.rb +++ b/spec/controllers/projects/mattermosts_controller_spec.rb @@ -13,13 +13,13 @@ describe Projects::MattermostsController do before do allow_any_instance_of(MattermostSlashCommandsService). to receive(:list_teams).and_return([]) + end + it 'accepts the request' do get(:new, namespace_id: project.namespace.to_param, project_id: project.to_param) - end - it 'accepts the request' do expect(response).to have_http_status(200) end end diff --git a/spec/features/projects/services/mattermost_slash_command_spec.rb b/spec/features/projects/services/mattermost_slash_command_spec.rb index 86a07b2c679..042a1ccab51 100644 --- a/spec/features/projects/services/mattermost_slash_command_spec.rb +++ b/spec/features/projects/services/mattermost_slash_command_spec.rb @@ -99,6 +99,15 @@ feature 'Setup Mattermost slash commands', feature: true do expect(select_element.all('option').count).to eq(3) end + it 'shows an error alert with the error message if there is an error requesting teams' do + allow_any_instance_of(MattermostSlashCommandsService).to receive(:list_teams) { [[], 'test mattermost error message'] } + + click_link 'Add to Mattermost' + + expect(page).to have_selector('.alert') + expect(page).to have_content('test mattermost error message') + end + def stub_teams(count: 0) teams = create_teams(count) diff --git a/spec/models/project_services/mattermost_slash_commands_service_spec.rb b/spec/models/project_services/mattermost_slash_commands_service_spec.rb index c879edddfdd..98f3d420c8a 100644 --- a/spec/models/project_services/mattermost_slash_commands_service_spec.rb +++ b/spec/models/project_services/mattermost_slash_commands_service_spec.rb @@ -113,10 +113,7 @@ describe MattermostSlashCommandsService, :models do end it 'shows error messages' do - teams, message = subject - - expect(teams).to be_empty - expect(message).to eq('Failed to get team list.') + expect(subject).to eq([[], "Failed to get team list."]) end end end |