BigW Consortium Gitlab

Commit 3bff8da8 by James Lopez

fix service spec

parent 3d807dc8
......@@ -257,7 +257,7 @@ class Service < ActiveRecord::Base
def update_and_propagate(service_params)
return false unless update_attributes(service_params)
if service_params[:active] == 1
if service_params[:active]
PropagateProjectServiceWorker.perform_async(service_params[:id])
end
......
......@@ -256,26 +256,27 @@ describe Service, models: true do
end
describe "#update_and_propagate" do
let(:project) { create(:empty_project) }
let!(:service) do
RedmineService.new(
project: project,
active: false,
properties: {
project_url: 'http://redmine/projects/project_name_in_redmine',
issues_url: "http://redmine/#{project.id}/project_name_in_redmine/:id",
new_issue_url: 'http://redmine/projects/project_name_in_redmine/issues/new'
project_url: 'http://abc',
issues_url: 'http://abc',
new_issue_url: 'http://abc'
}
)
end
it 'updates the service params successfully and calls the propagation worker' do
expect(PropagateProjectServiceWorker).to receve(:perform_async)
expect(PropagateProjectServiceWorker).to receive(:perform_async)
expect(service.update_and_propagate(active: true)).to be true
end
it 'updates the service params successfully' do
expect(PropagateProjectServiceWorker).not_to receve(:perform_asyncs)
expect(PropagateProjectServiceWorker).not_to receive(:perform_async)
expect(service.update_and_propagate(properties: {})).to be true
end
......
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