diff --git a/app/models/tag.rb b/app/models/tag.rb index a9fd6adba..51e27c30f 100644 --- a/app/models/tag.rb +++ b/app/models/tag.rb @@ -1,7 +1,7 @@ class Tag < ApplicationRecord include Filterable - belongs_to :account, default: -> { Current.account } + belongs_to :account, default: -> { Current.account }, touch: true has_many :taggings, dependent: :destroy has_many :bubbles, through: :taggings diff --git a/test/models/tag_test.rb b/test/models/tag_test.rb index 1846cdbcb..554056941 100644 --- a/test/models/tag_test.rb +++ b/test/models/tag_test.rb @@ -1,7 +1,15 @@ require "test_helper" class TagTest < ActiveSupport::TestCase - # test "the truth" do - # assert true - # end + test "creating or deleting a tag touches the account, so tags dialog fragment cache is invalidated" do + account = accounts("37s") + + assert_changes -> { account.reload.updated_at } do + account.tags.create!(title: "ReleaseBlocker") + end + + assert_changes -> { account.reload.updated_at } do + account.tags.find_by(title: "ReleaseBlocker").destroy + end + end end