diff options
author | Jenkins <jenkins@jenkins.ninjawedding.org> | 2018-02-19 15:17:14 +0000 |
---|---|---|
committer | Jenkins <jenkins@jenkins.ninjawedding.org> | 2018-02-19 15:17:14 +0000 |
commit | 1445ba17033cdfdd21d0999f65267754af6344af (patch) | |
tree | 4919ecd746c8dec4be33af47d83f11cec098cf69 /spec/models | |
parent | 3d033a468748338b6036cb24bb00ea4e88656ae6 (diff) | |
parent | 66105929e07fc7ddbdb8b66696b9ce1ed5d25957 (diff) |
Merge remote-tracking branch 'tootsuite/master' into glitchsoc/master
Diffstat (limited to 'spec/models')
-rw-r--r-- | spec/models/setting_spec.rb | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/spec/models/setting_spec.rb b/spec/models/setting_spec.rb index bbba5f98d..1cc528674 100644 --- a/spec/models/setting_spec.rb +++ b/spec/models/setting_spec.rb @@ -42,11 +42,6 @@ RSpec.describe Setting, type: :model do described_class[key] end - it 'calls Rails.cache.fetch' do - expect(Rails).to receive_message_chain(:cache, :fetch).with(cache_key) - described_class[key] - end - context 'Rails.cache does not exists' do before do allow(RailsSettings::Settings).to receive(:object).with(key).and_return(object) @@ -103,6 +98,14 @@ RSpec.describe Setting, type: :model do Rails.cache.write(cache_key, cache_value) end + it 'does not query the database' do + expect do |callback| + ActiveSupport::Notifications.subscribed callback, 'sql.active_record' do + described_class[key] + end + end.not_to yield_control + end + it 'returns the cached value' do expect(described_class[key]).to eq cache_value end |