summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatija Čupić <matteeyah@gmail.com>2018-02-06 18:42:28 +0100
committerMatija Čupić <matteeyah@gmail.com>2018-02-06 19:00:35 +0100
commit2d2a4ede1f09f7ca98508ad586e56a8cb7285fe3 (patch)
treead0597cba8c0a008452929def6d7174d7fd0bdc7
parentaab953da7d26e4ac654e50e80beca1083ea4f11f (diff)
downloadgitlab-ce-2d2a4ede1f09f7ca98508ad586e56a8cb7285fe3.tar.gz
Use double instead of runner in RedisCacheable spec
-rw-r--r--spec/models/concerns/redis_cacheable_spec.rb14
1 files changed, 9 insertions, 5 deletions
diff --git a/spec/models/concerns/redis_cacheable_spec.rb b/spec/models/concerns/redis_cacheable_spec.rb
index 3edb69f4666..d6a7d7d1462 100644
--- a/spec/models/concerns/redis_cacheable_spec.rb
+++ b/spec/models/concerns/redis_cacheable_spec.rb
@@ -1,14 +1,18 @@
require 'spec_helper'
describe RedisCacheable do
- let(:runner) { build(:ci_runner) }
+ let(:model) { double }
+
+ before do
+ model.extend(described_class)
+ end
describe '#cached_attribute' do
- subject { runner.cached_attribute(:anything) }
+ subject { model.cached_attribute(:anything) }
it 'gets the cache attribute' do
Gitlab::Redis::SharedState.with do |redis|
- expect(redis).to receive(:get).with(runner.send(:cache_attribute_key))
+ expect(redis).to receive(:get).with(model.send(:cache_attribute_key))
end
subject
@@ -18,12 +22,12 @@ describe RedisCacheable do
describe '#cache_attributes' do
let(:values) { { name: 'new_name' } }
- subject { runner.cache_attributes(values) }
+ subject { model.cache_attributes(values) }
it 'sets the cache attributes' do
Gitlab::Redis::SharedState.with do |redis|
values.each do |key, value|
- redis_key = runner.send(:cache_attribute_key)
+ redis_key = model.send(:cache_attribute_key)
expect(redis).to receive(:set).with(redis_key, values.to_json, anything)
end
end