adds touch to debates on tag destroy
This commit is contained in:
@@ -1 +1,8 @@
|
|||||||
|
ActsAsTaggableOn::Tagging.class_eval do
|
||||||
|
after_destroy :touch_taggable
|
||||||
|
|
||||||
|
def touch_taggable
|
||||||
|
taggable.touch
|
||||||
|
end
|
||||||
|
|
||||||
|
end
|
||||||
14
spec/lib/cache_spec.rb
Normal file
14
spec/lib/cache_spec.rb
Normal file
@@ -0,0 +1,14 @@
|
|||||||
|
require 'rails_helper'
|
||||||
|
|
||||||
|
describe 'Cache flow' do
|
||||||
|
|
||||||
|
describe 'Tag destroy' do
|
||||||
|
it 'invalidates Debate cache keys' do
|
||||||
|
debate = create(:debate, tag_list: "Good, Bad")
|
||||||
|
tag = ActsAsTaggableOn::Tag.find_by(name: "Bad")
|
||||||
|
|
||||||
|
expect{tag.destroy}.to change {debate.reload.cache_key}
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
end
|
||||||
Reference in New Issue
Block a user