diff options
author | Kamil Trzcinski <ayufan@ayufan.eu> | 2017-01-19 23:31:03 +0100 |
---|---|---|
committer | Kamil Trzcinski <ayufan@ayufan.eu> | 2017-01-19 23:31:03 +0100 |
commit | 31af6be076635e6c6936564558bb977740d39eb0 (patch) | |
tree | 64cd70414baef55935f3e5bc360d7dd27d692307 /spec/models/ci | |
parent | 1c7eb963f5e9b5992e55a3dd0a025f019d72c84b (diff) | |
download | gitlab-ce-31af6be076635e6c6936564558bb977740d39eb0.tar.gz |
Fix specs
Diffstat (limited to 'spec/models/ci')
-rw-r--r-- | spec/models/ci/runner_spec.rb | 33 |
1 files changed, 28 insertions, 5 deletions
diff --git a/spec/models/ci/runner_spec.rb b/spec/models/ci/runner_spec.rb index 06eaa6d04d9..2b856ca7af7 100644 --- a/spec/models/ci/runner_spec.rb +++ b/spec/models/ci/runner_spec.rb @@ -277,21 +277,44 @@ describe Ci::Runner, models: true do it 'sets a new last_update value when it is called the first time' do last_update = runner.ensure_runner_queue_value - expect_value_in_redis(last_update) + expect_value_in_redis.to eq(last_update) end it 'does not change if it is not expired and called again' do last_update = runner.ensure_runner_queue_value expect(runner.ensure_runner_queue_value).to eq(last_update) - expect_value_in_redis(last_update) + expect_value_in_redis.to eq(last_update) end - def expect_value_in_redis(last_update) + context 'updates runner queue after changing editable value' do + let!(:last_update) { runner.ensure_runner_queue_value } + + before do + runner.update(description: 'new runner') + end + + it 'sets a new last_update value' do + expect_value_in_redis.not_to eq(last_update) + end + end + + context 'does not update runner value after save' do + let!(:last_update) { runner.ensure_runner_queue_value } + + before do + runner.touch + end + + it 'has an old last_update value' do + expect_value_in_redis.to eq(last_update) + end + end + + def expect_value_in_redis Gitlab::Redis.with do |redis| runner_queue_key = runner.send(:runner_queue_key) - - expect(redis.get(runner_queue_key)).to eq(last_update) + expect(redis.get(runner_queue_key)) end end end |