diff options
author | Mario de la Ossa <mariodelaossa@gmail.com> | 2019-07-04 02:12:02 +0300 |
---|---|---|
committer | Mario de la Ossa <mariodelaossa@gmail.com> | 2019-07-11 06:35:43 +0300 |
commit | e5705f5c540755a672de5acf9d5710c24ccc6b27 (patch) | |
tree | ba5609a78b4b926c4a96f29668af76bd2bc12cf9 /spec/models/commit_range_spec.rb | |
parent | 62e52ac6a8130c080f498ee2f76ef50b8c209f0f (diff) |
Banzai - avoid redis if attr is in DB cache
When cache_collection_render runs we end up reading and writing
things to redis even if we already have the rendered field cached
in the DB. This commit avoids using redis at all whenever we have
the field already rendered in the DB cache.
Diffstat (limited to 'spec/models/commit_range_spec.rb')
-rw-r--r-- | spec/models/commit_range_spec.rb | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/spec/models/commit_range_spec.rb b/spec/models/commit_range_spec.rb index b96ca89c893..4a524b585e1 100644 --- a/spec/models/commit_range_spec.rb +++ b/spec/models/commit_range_spec.rb @@ -139,8 +139,8 @@ describe CommitRange do end describe '#has_been_reverted?' do - let(:issue) { create(:issue) } - let(:user) { issue.author } + let(:user) { create(:user) } + let(:issue) { create(:issue, author: user, project: project) } it 'returns true if the commit has been reverted' do create(:note_on_issue, @@ -149,9 +149,11 @@ describe CommitRange do note: commit1.revert_description(user), project: issue.project) - expect_any_instance_of(Commit).to receive(:reverts_commit?) - .with(commit1, user) - .and_return(true) + expect_next_instance_of(Commit) do |commit| + expect(commit).to receive(:reverts_commit?) + .with(commit1, user) + .and_return(true) + end expect(commit1.has_been_reverted?(user, issue.notes_with_associations)).to eq(true) end |