966aa51a37
touch_all on 10K cards took 6ms in testing
34 lines
927 B
Ruby
34 lines
927 B
Ruby
require "test_helper"
|
|
|
|
class ColumnTest < ActiveSupport::TestCase
|
|
test "creates column with default color when color not provided" do
|
|
column = collections(:writebook).columns.create!(name: "New Column")
|
|
|
|
assert_equal Card::DEFAULT_COLOR, column.color
|
|
end
|
|
|
|
test "touch all the cards when the name or color changes" do
|
|
column = columns(:writebook_triage)
|
|
|
|
assert_changes -> { column.cards.first.updated_at } do
|
|
column.update!(name: "New Name")
|
|
end
|
|
|
|
assert_changes -> { column.cards.first.updated_at } do
|
|
column.update!(color: "#FF0000")
|
|
end
|
|
|
|
assert_no_changes -> { column.cards.first.updated_at } do
|
|
column.update!(updated_at: 1.hour.from_now)
|
|
end
|
|
end
|
|
|
|
test "touch all collection cards when column is destroyed" do
|
|
column = columns(:writebook_triage)
|
|
|
|
assert_changes -> { column.collection.cards.first.updated_at } do
|
|
column.destroy
|
|
end
|
|
end
|
|
end
|