summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--spec/models/concerns/redis_cacheable_spec.rb11
1 files changed, 8 insertions, 3 deletions
diff --git a/spec/models/concerns/redis_cacheable_spec.rb b/spec/models/concerns/redis_cacheable_spec.rb
index d6a7d7d1462..ffb35079149 100644
--- a/spec/models/concerns/redis_cacheable_spec.rb
+++ b/spec/models/concerns/redis_cacheable_spec.rb
@@ -8,14 +8,19 @@ describe RedisCacheable do
end
describe '#cached_attribute' do
- subject { model.cached_attribute(:anything) }
+ let(:payload) { { attribute: 'value' } }
+
+ subject { model.cached_attribute(payload.keys.first) }
it 'gets the cache attribute' do
+ expect(model).to receive(:cache_attribute_key).and_return('key')
+
Gitlab::Redis::SharedState.with do |redis|
- expect(redis).to receive(:get).with(model.send(:cache_attribute_key))
+ expect(redis).to receive(:get).with('key')
+ .and_return(payload.to_json)
end
- subject
+ expect(subject).to eq(payload.values.first)
end
end