diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-02-29 09:08:06 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-02-29 09:08:06 +0300 |
commit | 1ab1a6eefa84e1530663edf3b711f34c0d4e535e (patch) | |
tree | 47f87c401c8cf922527c5208aa8c67ee36d4f9ba /spec/services/projects | |
parent | d94ed2a46aad78435de66af05c84060ae78c8fc0 (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/services/projects')
-rw-r--r-- | spec/services/projects/operations/update_service_spec.rb | 43 |
1 files changed, 8 insertions, 35 deletions
diff --git a/spec/services/projects/operations/update_service_spec.rb b/spec/services/projects/operations/update_service_spec.rb index 182906a3337..de028ecb693 100644 --- a/spec/services/projects/operations/update_service_spec.rb +++ b/spec/services/projects/operations/update_service_spec.rb @@ -298,55 +298,28 @@ describe Projects::Operations::UpdateService do manual_configuration: "0" }) end - let(:prometheus_params) do - { - "type" => "PrometheusService", - "title" => nil, - "active" => true, - "properties" => { "api_url" => "http://example.prometheus.com", "manual_configuration" => "0" }, - "push_events" => true, - "issues_events" => true, - "merge_requests_events" => true, - "tag_push_events" => true, - "note_events" => true, - "category" => "monitoring", - "default" => false, - "wiki_page_events" => true, - "pipeline_events" => true, - "confidential_issues_events" => true, - "commit_events" => true, - "job_events" => true, - "confidential_note_events" => true, - "deployment_events" => false, - "description" => nil, - "comment_on_event_enabled" => true, - "template" => false - } - end let(:params) do { prometheus_integration_attributes: { - api_url: 'http://new.prometheus.com', - manual_configuration: '1' + 'api_url' => 'http://new.prometheus.com', + 'manual_configuration' => '1' } } end it 'uses Project#find_or_initialize_service to include instance defined defaults and pass them to Projects::UpdateService', :aggregate_failures do project_update_service = double(Projects::UpdateService) - prometheus_update_params = prometheus_params.merge('properties' => { - 'api_url' => 'http://new.prometheus.com', - 'manual_configuration' => '1' - }) expect(project) .to receive(:find_or_initialize_service) .with('prometheus') .and_return(prometheus_service) - expect(Projects::UpdateService) - .to receive(:new) - .with(project, user, { prometheus_service_attributes: prometheus_update_params }) - .and_return(project_update_service) + expect(Projects::UpdateService).to receive(:new) do |project_arg, user_arg, update_params_hash| + expect(project_arg).to eq project + expect(user_arg).to eq user + expect(update_params_hash[:prometheus_service_attributes]).to include('properties' => { 'api_url' => 'http://new.prometheus.com', 'manual_configuration' => '1' }) + expect(update_params_hash[:prometheus_service_attributes]).not_to include(*%w(id project_id created_at updated_at)) + end.and_return(project_update_service) expect(project_update_service).to receive(:execute) subject.execute |