diff options
Diffstat (limited to 'spec/features/projects/services/user_activates_jira_spec.rb')
-rw-r--r-- | spec/features/projects/services/user_activates_jira_spec.rb | 44 |
1 files changed, 41 insertions, 3 deletions
diff --git a/spec/features/projects/services/user_activates_jira_spec.rb b/spec/features/projects/services/user_activates_jira_spec.rb index 85afc54be48..3b8032e1d0d 100644 --- a/spec/features/projects/services/user_activates_jira_spec.rb +++ b/spec/features/projects/services/user_activates_jira_spec.rb @@ -6,12 +6,14 @@ RSpec.describe 'User activates Jira', :js do include_context 'project service activation' include_context 'project service Jira context' + before do + server_info = { key: 'value' }.to_json + stub_request(:get, test_url).to_return(body: server_info) + end + describe 'user tests Jira Service' do context 'when Jira connection test succeeds' do before do - server_info = { key: 'value' }.to_json - stub_request(:get, test_url).with(basic_auth: %w(username password)).to_return(body: server_info) - visit_project_integration('Jira') fill_form click_test_then_save_integration(expect_test_to_fail: false) @@ -81,4 +83,40 @@ RSpec.describe 'User activates Jira', :js do end end end + + describe 'issue transition settings' do + it 'shows validation errors' do + visit_project_integration('Jira') + + expect(page).to have_field('Move to Done', checked: true) + + fill_form + choose 'Use custom transitions' + click_save_integration + + within '[data-testid="issue-transition-settings"]' do + expect(page).to have_content('This field is required.') + end + + fill_in 'service[jira_issue_transition_id]', with: '1, 2, 3' + click_save_integration + + expect(page).to have_content('Jira settings saved and active.') + expect(project.reload.jira_service.jira_issue_transition_id).to eq('1, 2, 3') + end + + it 'clears the transition IDs when using automatic transitions' do + create(:jira_service, project: project, jira_issue_transition_id: '1, 2, 3') + visit_project_integration('Jira') + + expect(page).to have_field('Use custom transitions', checked: true) + expect(page).to have_field('service[jira_issue_transition_id]', with: '1, 2, 3') + + choose 'Move to Done' + click_save_integration + + expect(page).to have_content('Jira settings saved and active.') + expect(project.reload.jira_service.jira_issue_transition_id).to eq('') + end + end end |