af0113c9ee
The change in https://github.com/basecamp/fizzy/commit/c606de7b41f57734c4c859c5fc3d98c952b26d58#diff-1ecde9fb1ee2494e5d94e807f51f861928f77cfcfb0884889911b62a32c2ff4cL4-R23 was preventing marking cards as golden from broadcasting
43 lines
975 B
Ruby
43 lines
975 B
Ruby
require "test_helper"
|
|
|
|
class Card::GoldenTest < ActiveSupport::TestCase
|
|
setup do
|
|
Current.session = sessions(:david)
|
|
end
|
|
|
|
test "check whether a card is golden" do
|
|
assert cards(:logo).golden?
|
|
assert_not cards(:text).golden?
|
|
end
|
|
|
|
test "promote and demote from golden" do
|
|
assert_changes -> { cards(:text).reload.golden? }, to: true do
|
|
cards(:text).gild
|
|
end
|
|
|
|
assert_changes -> { cards(:logo).reload.golden? }, to: false do
|
|
cards(:logo).ungild
|
|
end
|
|
end
|
|
|
|
test "scopes" do
|
|
assert_includes Card.golden, cards(:logo)
|
|
assert_not_includes Card.golden, cards(:text)
|
|
end
|
|
|
|
test "gilding a card touches both the card and the board" do
|
|
card = cards(:text)
|
|
board = card.board
|
|
|
|
card_updated_at = card.updated_at
|
|
board_updated_at = board.updated_at
|
|
|
|
travel 1.minute do
|
|
card.gild
|
|
end
|
|
|
|
assert card.reload.updated_at > card_updated_at
|
|
assert board.reload.updated_at > board_updated_at
|
|
end
|
|
end
|