Added error message and test

This commit is contained in:
Luke "Jared" Bennett 2017-01-24 17:54:30 +00:00
parent 85f0229b15
commit 8bcc911b9b
No known key found for this signature in database
GPG key ID: 402ED51FB5D306C2
3 changed files with 13 additions and 1 deletions

View file

@ -1,3 +1,6 @@
= content_for :flash_message do
.alert.alert-danger= @teams if @teams.is_a?(String)
%p
You arent a member of any team on the Mattermost instance at
%strong= Gitlab.config.mattermost.host

View file

@ -2,7 +2,7 @@
.inline.pull-right
= custom_icon('mattermost_logo', size: 48)
%h3 Install Mattermost Command
- if @teams.empty?
- if @teams.is_a?(String) || @teams.empty?
= render 'no_teams'
- else
= render 'team_selection'

View file

@ -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)