diff options
Diffstat (limited to 'spec/support/shared_examples/features/integrations/user_activates_mattermost_slash_command_integration_shared_examples.rb')
-rw-r--r-- | spec/support/shared_examples/features/integrations/user_activates_mattermost_slash_command_integration_shared_examples.rb | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/spec/support/shared_examples/features/integrations/user_activates_mattermost_slash_command_integration_shared_examples.rb b/spec/support/shared_examples/features/integrations/user_activates_mattermost_slash_command_integration_shared_examples.rb new file mode 100644 index 00000000000..cfa043322db --- /dev/null +++ b/spec/support/shared_examples/features/integrations/user_activates_mattermost_slash_command_integration_shared_examples.rb @@ -0,0 +1,34 @@ +# frozen_string_literal: true + +RSpec.shared_examples 'user activates the Mattermost Slash Command integration' do + it 'shows a help message' do + expect(page).to have_content('Use this service to perform common') + end + + it 'shows a token placeholder' do + token_placeholder = find_field('service_token')['placeholder'] + + expect(token_placeholder).to eq('XXxxXXxxXXxxXXxxXXxxXXxx') + end + + it 'redirects to the integrations page after saving but not activating' do + token = ('a'..'z').to_a.join + + fill_in 'service_token', with: token + click_active_checkbox + click_save_integration + + expect(current_path).to eq(edit_path) + expect(page).to have_content('Mattermost slash commands settings saved, but not active.') + end + + it 'redirects to the integrations page after activating' do + token = ('a'..'z').to_a.join + + fill_in 'service_token', with: token + click_save_integration + + expect(current_path).to eq(edit_path) + expect(page).to have_content('Mattermost slash commands settings saved and active.') + end +end |