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

Check return value in RedisCacheable#cached_attribute spec

parent 2d2a4ede
......@@ -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
......
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