Update bust_comment to BustComment (#11895)

This commit is contained in:
Alex 2020-12-16 12:59:54 -05:00 committed by GitHub
parent 573380f2b8
commit 1ab88ef77b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 6 additions and 6 deletions

View file

@ -11,7 +11,7 @@ module Users
article.buffer_updates.delete_all
article.comments.includes(:user).find_each do |comment|
comment.reactions.delete_all
cache_buster.bust_comment(comment.commentable)
EdgeCache::BustComment.call(comment.commentable)
cache_buster.bust_user(comment.user)
comment.remove_from_elasticsearch
comment.delete

View file

@ -7,7 +7,7 @@ module Users
user.comments.find_each do |comment|
comment.reactions.delete_all
cache_buster.bust_comment(comment.commentable)
EdgeCache::BustComment.call(comment.commentable)
comment.remove_notifications
comment.remove_from_elasticsearch
comment.delete

View file

@ -26,7 +26,7 @@ RSpec.describe Users::DeleteArticles, type: :service do
let(:buster) { double }
before do
allow(buster).to receive(:bust_comment)
allow(EdgeCache::BustComment).to receive(:call)
allow(buster).to receive(:bust_article)
allow(buster).to receive(:bust_user)
@ -48,7 +48,7 @@ RSpec.describe Users::DeleteArticles, type: :service do
it "busts cache" do
described_class.call(user, buster)
expect(buster).to have_received(:bust_comment).with(article).twice
expect(EdgeCache::BustComment).to have_received(:call).with(article).twice
expect(buster).to have_received(:bust_user).with(user2).at_least(:once)
expect(buster).to have_received(:bust_article).with(article)
end

View file

@ -10,7 +10,7 @@ RSpec.describe Users::DeleteComments, type: :service do
before do
create_list(:comment, 2, commentable: article, user: user)
allow(buster).to receive(:bust_comment)
allow(EdgeCache::BustComment).to receive(:call)
allow(buster).to receive(:bust_user)
end
@ -30,7 +30,7 @@ RSpec.describe Users::DeleteComments, type: :service do
it "busts cache" do
described_class.call(user, buster)
expect(buster).to have_received(:bust_comment).with(article).at_least(:once)
expect(EdgeCache::BustComment).to have_received(:call).with(article).at_least(:once)
expect(buster).to have_received(:bust_user).with(user)
end