docbrown/spec/labor/cache_buster_spec.rb
Jess Lee 7bf9a8ce89 Delayed Jobs Investigation (#929)
* disallow nil reactables to be saved

* investigation wip

* passes deleted comment info to async bust cache

* fixes failing cache buster spec

* Create user_delete_a_comment_spec.rb

* Fix broken spec

* Binstub RuboCop

* Do not save comments when they are getting destroyed

* break update_reactable into smaller methods
2018-10-17 17:03:20 -04:00

21 lines
630 B
Ruby

require "rails_helper"
RSpec.describe CacheBuster do
let(:user) { create(:user) }
let(:article) { create(:article, user_id: user.id) }
let(:comment) { create(:comment, user_id: user.id, commentable_id: article.id) }
it "busts comment" do
commentable = Article.find(comment.commentable_id)
username = User.find(comment.user_id).username
described_class.new.bust_comment(commentable, username)
end
it "busts article" do
described_class.new.bust_article(article)
end
it "busts featured article" do
article.featured = true
article.save
described_class.new.bust_article(article)
end
end