summaryrefslogtreecommitdiff
path: root/spec/models
diff options
context:
space:
mode:
authorKamil Trzciński <ayufan@ayufan.eu>2017-02-17 13:03:12 +0000
committerKamil Trzciński <ayufan@ayufan.eu>2017-02-17 13:03:12 +0000
commitf662bc5a866dc24580caa48952f25061bae60d1a (patch)
tree1cd3c637b0581056aa9ce608e08b974e870a4607 /spec/models
parent5cc9ebbe14ce35de1ec45fc7abce3aa9f408ddf2 (diff)
parent60288d6c62d7e65ed5a93a72ba047ccaa2daa22b (diff)
downloadgitlab-ce-f662bc5a866dc24580caa48952f25061bae60d1a.tar.gz
Merge branch 'use-update-runner-service' into 'master'
Prefer service object over after_save hook Closes #26921 See merge request !8664
Diffstat (limited to 'spec/models')
-rw-r--r--spec/models/ci/runner_spec.rb21
1 files changed, 20 insertions, 1 deletions
diff --git a/spec/models/ci/runner_spec.rb b/spec/models/ci/runner_spec.rb
index 3f32248e52b..f8513ac8b1c 100644
--- a/spec/models/ci/runner_spec.rb
+++ b/spec/models/ci/runner_spec.rb
@@ -290,7 +290,7 @@ describe Ci::Runner, models: true do
let!(:last_update) { runner.ensure_runner_queue_value }
before do
- runner.update(description: 'new runner')
+ Ci::UpdateRunnerService.new(runner).update(description: 'new runner')
end
it 'sets a new last_update value' do
@@ -318,6 +318,25 @@ describe Ci::Runner, models: true do
end
end
+ describe '#destroy' do
+ let(:runner) { create(:ci_runner) }
+
+ context 'when there is a tick in the queue' do
+ let!(:queue_key) { runner.send(:runner_queue_key) }
+
+ before do
+ runner.tick_runner_queue
+ runner.destroy
+ end
+
+ it 'cleans up the queue' do
+ Gitlab::Redis.with do |redis|
+ expect(redis.get(queue_key)).to be_nil
+ end
+ end
+ end
+ end
+
describe '.assignable_for' do
let(:runner) { create(:ci_runner) }
let(:project) { create(:empty_project) }