Fix: allow destroying "not now" state when closing cards
- Update `Card::Closeable` to destroy associated "not now" state during close. - Add new tests to verify closure behavior for different column types, including "not now".
This commit is contained in:
@@ -31,6 +31,7 @@ module Card::Closeable
|
||||
def close(user: Current.user)
|
||||
unless closed?
|
||||
transaction do
|
||||
not_now&.destroy
|
||||
create_closure! user: user
|
||||
track_event :closed, creator: user
|
||||
end
|
||||
|
||||
@@ -31,4 +31,32 @@ class Card::CloseableTest < ActiveSupport::TestCase
|
||||
assert cards(:shipping).reload.open?
|
||||
assert cards(:shipping).events.last.action.card_reopened?
|
||||
end
|
||||
|
||||
test "close card from triage column" do
|
||||
card = cards(:logo)
|
||||
assert_equal columns(:writebook_triage), card.column
|
||||
|
||||
card.close
|
||||
assert card.closed?
|
||||
end
|
||||
|
||||
test "close card from active column" do
|
||||
card = cards(:text)
|
||||
assert_equal columns(:writebook_in_progress), card.column
|
||||
|
||||
card.close
|
||||
assert card.closed?
|
||||
end
|
||||
|
||||
test "close card from NOT NOW" do
|
||||
card = cards(:logo)
|
||||
|
||||
card.postpone
|
||||
assert card.postponed?
|
||||
assert card.not_now.present?
|
||||
|
||||
card.close
|
||||
assert card.closed?
|
||||
assert_nil card.reload.not_now
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user