Ensure that a "reconsidered" card gets an updated timestamp
so that it's not closed by the subsequent Card::AutoCloseAllDueJob ref: https://37s.fizzy.37signals.com/collections/693169850/cards/999009030
This commit is contained in:
@@ -49,6 +49,7 @@ module Card::Engageable
|
||||
transaction do
|
||||
reopen
|
||||
engagement&.destroy
|
||||
touch(:last_active_at)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -48,6 +48,8 @@ class Card::EngageableTest < ActiveSupport::TestCase
|
||||
end
|
||||
|
||||
test "auto_reconsider_all_stagnated" do
|
||||
travel_to Time.current
|
||||
|
||||
cards(:logo, :shipping).each(&:engage)
|
||||
|
||||
cards(:logo).update!(last_active_at: 1.day.ago - Card::Engageable::STAGNATED_AFTER)
|
||||
@@ -59,5 +61,6 @@ class Card::EngageableTest < ActiveSupport::TestCase
|
||||
|
||||
assert cards(:shipping).reload.doing?
|
||||
assert cards(:logo).reload.considering?
|
||||
assert_equal Time.current, cards(:logo).last_active_at
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user