Skip to content

Commit e7b9655

Browse files
committed
Add regression test for event particulars defaults
1 parent be1b539 commit e7b9655

File tree

1 file changed

+33
-0
lines changed

1 file changed

+33
-0
lines changed

test/models/event_test.rb

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,4 +17,37 @@ class EventTest < ActiveSupport::TestCase
1717
relation.for_creators([]).for_boards([]).load
1818
end
1919
end
20+
21+
test "api_particulars returns empty strings for missing nested board change values" do
22+
event = boards(:writebook).events.create!(
23+
action: "card_board_changed",
24+
creator: users(:david),
25+
eventable: cards(:logo),
26+
account: accounts("37s"),
27+
particulars: {}
28+
)
29+
30+
assert_equal({ "old_board" => "", "new_board" => "" }, event.api_particulars)
31+
end
32+
33+
test "api_particulars returns empty strings for missing nested title and column values" do
34+
title_event = boards(:writebook).events.create!(
35+
action: "card_title_changed",
36+
creator: users(:david),
37+
eventable: cards(:logo),
38+
account: accounts("37s"),
39+
particulars: {}
40+
)
41+
42+
triage_event = boards(:writebook).events.create!(
43+
action: "card_triaged",
44+
creator: users(:david),
45+
eventable: cards(:logo),
46+
account: accounts("37s"),
47+
particulars: {}
48+
)
49+
50+
assert_equal({ "old_title" => "", "new_title" => "" }, title_event.api_particulars)
51+
assert_equal({ "column" => "" }, triage_event.api_particulars)
52+
end
2053
end

0 commit comments

Comments
 (0)