Commit 6fad5640 authored by Jarka Kadlecova's avatar Jarka Kadlecova

fix failing specs

parent b71025c0
......@@ -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
......
......@@ -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))
......
......@@ -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) }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment