diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2022-02-18 09:45:46 +0000 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2022-02-18 09:45:46 +0000 |
commit | a7b3560714b4d9cc4ab32dffcd1f74a284b93580 (patch) | |
tree | 7452bd5c3545c2fa67a28aa013835fb4fa071baf /spec/graphql/mutations/ci/runner/delete_spec.rb | |
parent | ee9173579ae56a3dbfe5afe9f9410c65bb327ca7 (diff) | |
download | gitlab-ce-a7b3560714b4d9cc4ab32dffcd1f74a284b93580.tar.gz |
Add latest changes from gitlab-org/gitlab@14-8-stable-eev14.8.0-rc42
Diffstat (limited to 'spec/graphql/mutations/ci/runner/delete_spec.rb')
-rw-r--r-- | spec/graphql/mutations/ci/runner/delete_spec.rb | 15 |
1 files changed, 12 insertions, 3 deletions
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 |