diff options
-rw-r--r-- | spec/controllers/projects/services_controller_spec.rb | 4 | ||||
-rw-r--r-- | spec/features/projects/services/jira_service_spec.rb | 8 | ||||
-rw-r--r-- | spec/models/project_services/jira_service_spec.rb | 35 |
3 files changed, 6 insertions, 41 deletions
diff --git a/spec/controllers/projects/services_controller_spec.rb b/spec/controllers/projects/services_controller_spec.rb index 7aa2492edf6..4fe1e848965 100644 --- a/spec/controllers/projects/services_controller_spec.rb +++ b/spec/controllers/projects/services_controller_spec.rb @@ -64,14 +64,14 @@ describe Projects::ServicesController do end context 'failure' do - it 'returns 500 status code and the error message' do + it 'returns success status code and the error message' do expect(HipChat::Client).to receive(:new).with('hipchat_token_p', anything).and_raise('Bad test') put :test, namespace_id: project.namespace.id, project_id: project.id, id: service.id, service: service_params expect(response.status).to eq(200) expect(JSON.parse(response.body)). - to eq('error' => true, 'message' => 'Test failed', 'service_response' => 'Bad test') + to eq('error' => true, 'message' => 'Test failed.', 'service_response' => 'Bad test') end end end diff --git a/spec/features/projects/services/jira_service_spec.rb b/spec/features/projects/services/jira_service_spec.rb index d40c332be6f..3d951d6b3e3 100644 --- a/spec/features/projects/services/jira_service_spec.rb +++ b/spec/features/projects/services/jira_service_spec.rb @@ -35,7 +35,7 @@ feature 'Setup Jira service', :feature, :js do click_link('JIRA') fill_form click_button('Test settings and save changes') - wait_for_ajax + wait_for_requests expect(page).to have_content('JIRA activated.') expect(current_path).to eq(namespace_project_settings_integrations_path(project.namespace, project)) @@ -51,12 +51,12 @@ feature 'Setup Jira service', :feature, :js do click_link('JIRA') fill_form click_button('Test settings and save changes') - wait_for_ajax + wait_for_requests expect(page).to have_content('Test failed.Save anyway') - click_on('Save anyway') - wait_for_ajax + find('.flash-alert .flash-action').trigger('click') + wait_for_requests expect(page).to have_content('JIRA activated.') expect(current_path).to eq(namespace_project_settings_integrations_path(project.namespace, project)) diff --git a/spec/models/project_services/jira_service_spec.rb b/spec/models/project_services/jira_service_spec.rb index 1920b5bf42b..0ee050196e4 100644 --- a/spec/models/project_services/jira_service_spec.rb +++ b/spec/models/project_services/jira_service_spec.rb @@ -69,41 +69,6 @@ describe JiraService, models: true do end end - describe '#can_test?' do - let(:jira_service) { described_class.new } - - it 'returns false if username is blank' do - allow(jira_service).to receive_messages( - url: 'http://jira.example.com', - username: '', - password: '12345678' - ) - - expect(jira_service.can_test?).to be_falsy - end - - it 'returns false if password is blank' do - allow(jira_service).to receive_messages( - url: 'http://jira.example.com', - username: 'tester', - password: '' - ) - - expect(jira_service.can_test?).to be_falsy - end - - it 'returns true if password and username are present' do - jira_service = described_class.new - allow(jira_service).to receive_messages( - url: 'http://jira.example.com', - username: 'tester', - password: '12345678' - ) - - expect(jira_service.can_test?).to be_truthy - end - end - describe '#close_issue' do let(:custom_base_url) { 'http://custom_url' } let(:user) { create(:user) } |