diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2022-02-18 12:45:46 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2022-02-18 12:45:46 +0300 |
commit | a7b3560714b4d9cc4ab32dffcd1f74a284b93580 (patch) | |
tree | 7452bd5c3545c2fa67a28aa013835fb4fa071baf /spec/graphql/mutations | |
parent | ee9173579ae56a3dbfe5afe9f9410c65bb327ca7 (diff) |
Add latest changes from gitlab-org/gitlab@14-8-stable-eev14.8.0-rc42
Diffstat (limited to 'spec/graphql/mutations')
-rw-r--r-- | spec/graphql/mutations/alert_management/alerts/todo/create_spec.rb | 2 | ||||
-rw-r--r-- | spec/graphql/mutations/ci/runner/delete_spec.rb | 15 | ||||
-rw-r--r-- | spec/graphql/mutations/issues/create_spec.rb | 2 |
3 files changed, 14 insertions, 5 deletions
diff --git a/spec/graphql/mutations/alert_management/alerts/todo/create_spec.rb b/spec/graphql/mutations/alert_management/alerts/todo/create_spec.rb index 8ec99070c91..ea5e21ec4b8 100644 --- a/spec/graphql/mutations/alert_management/alerts/todo/create_spec.rb +++ b/spec/graphql/mutations/alert_management/alerts/todo/create_spec.rb @@ -8,7 +8,7 @@ RSpec.describe Mutations::AlertManagement::Alerts::Todo::Create do let_it_be(:alert) { create(:alert_management_alert) } let_it_be(:project) { alert.project } - let(:current_user) { project.owner } + let(:current_user) { project.first_owner } let(:args) { { project_path: project.full_path, iid: alert.iid } } diff --git a/spec/graphql/mutations/ci/runner/delete_spec.rb b/spec/graphql/mutations/ci/runner/delete_spec.rb index 9f30c95edd5..b53ee30f826 100644 --- a/spec/graphql/mutations/ci/runner/delete_spec.rb +++ b/spec/graphql/mutations/ci/runner/delete_spec.rb @@ -11,9 +11,7 @@ RSpec.describe Mutations::Ci::Runner::Delete do let(:current_ctx) { { current_user: user } } let(:mutation_params) do - { - id: runner.to_global_id - } + { id: runner.to_global_id } end specify { expect(described_class).to require_graphql_authorizations(:delete_runner) } @@ -57,6 +55,10 @@ RSpec.describe Mutations::Ci::Runner::Delete do it 'deletes runner' do mutation_params[:id] = project_runner.to_global_id + expect_next_instance_of(::Ci::UnregisterRunnerService, project_runner) do |service| + expect(service).to receive(:execute).once.and_call_original + end + expect { subject }.to change { Ci::Runner.count }.by(-1) expect(subject[:errors]).to be_empty end @@ -73,6 +75,9 @@ RSpec.describe Mutations::Ci::Runner::Delete do it 'does not delete project runner' do mutation_params[:id] = two_projects_runner.to_global_id + allow_next_instance_of(::Ci::UnregisterRunnerService) do |service| + expect(service).not_to receive(:execute).once + end expect { subject }.not_to change { Ci::Runner.count } expect(subject[:errors]).to contain_exactly("Runner #{two_projects_runner.to_global_id} associated with more than one project") end @@ -84,6 +89,10 @@ RSpec.describe Mutations::Ci::Runner::Delete do let(:current_ctx) { { current_user: admin_user } } it 'deletes runner' do + expect_next_instance_of(::Ci::UnregisterRunnerService, runner) do |service| + expect(service).to receive(:execute).once.and_call_original + end + expect { subject }.to change { Ci::Runner.count }.by(-1) expect(subject[:errors]).to be_empty end diff --git a/spec/graphql/mutations/issues/create_spec.rb b/spec/graphql/mutations/issues/create_spec.rb index 825d04ff827..e3094e84703 100644 --- a/spec/graphql/mutations/issues/create_spec.rb +++ b/spec/graphql/mutations/issues/create_spec.rb @@ -121,7 +121,7 @@ RSpec.describe Mutations::Issues::Create do end context 'when creating an issue as owner' do - let_it_be(:user) { project.owner } + let_it_be(:user) { project.first_owner } before do mutation_params.merge!(special_params) |