Commit e27ea805 authored by Matija Čupić's avatar Matija Čupić

Fix RedisCacheable#cache_attributes spec

parent b75fa80e
...@@ -5,6 +5,7 @@ describe RedisCacheable do ...@@ -5,6 +5,7 @@ describe RedisCacheable do
before do before do
model.extend(described_class) model.extend(described_class)
allow(model).to receive(:cache_attribute_key).and_return('key')
end end
describe '#cached_attribute' do describe '#cached_attribute' do
...@@ -13,8 +14,6 @@ describe RedisCacheable do ...@@ -13,8 +14,6 @@ describe RedisCacheable do
subject { model.cached_attribute(payload.keys.first) } subject { model.cached_attribute(payload.keys.first) }
it 'gets the cache attribute' do it 'gets the cache attribute' do
expect(model).to receive(:cache_attribute_key).and_return('key')
Gitlab::Redis::SharedState.with do |redis| Gitlab::Redis::SharedState.with do |redis|
expect(redis).to receive(:get).with('key') expect(redis).to receive(:get).with('key')
.and_return(payload.to_json) .and_return(payload.to_json)
...@@ -31,10 +30,7 @@ describe RedisCacheable do ...@@ -31,10 +30,7 @@ describe RedisCacheable do
it 'sets the cache attributes' do it 'sets the cache attributes' do
Gitlab::Redis::SharedState.with do |redis| Gitlab::Redis::SharedState.with do |redis|
values.each do |key, value| expect(redis).to receive(:set).with('key', values.to_json, anything)
redis_key = model.send(:cache_attribute_key)
expect(redis).to receive(:set).with(redis_key, values.to_json, anything)
end
end end
subject subject
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment