Fix some failing Tests

- Add explicit IDs to fixtures to avoid getting ints
- Remove ordering dependencies in assertions
This commit is contained in:
Kevin McConnell
2025-11-12 11:45:06 +00:00
committed by Mike Dalessio
parent 6c04b56f4b
commit c97ea9131f
11 changed files with 48 additions and 26 deletions
+2
View File
@@ -1,10 +1,12 @@
37s:
id: <%= ActiveRecord::FixtureSet.identify("37s_join_code", :uuid) %>
code: 37S0-5678-9XYZ
usage_count: 0
usage_limit: 10
account: 37s
initech:
id: <%= ActiveRecord::FixtureSet.identify("initech_join_code", :uuid) %>
code: INIT-5678-9XYZ
usage_count: 10
usage_limit: 10
+4 -1
View File
@@ -1,14 +1,17 @@
logo_agreement_jz:
id: <%= ActiveRecord::FixtureSet.identify("logo_agreement_jz_rich_text", :uuid) %>
record: logo_agreement_jz_uuid (Comment)
name: body
body: I agree.
logo_agreement_kevin:
id: <%= ActiveRecord::FixtureSet.identify("logo_agreement_kevin_rich_text", :uuid) %>
record: logo_agreement_kevin_uuid (Comment)
name: body
body: Same, lets do it.
body: Same, let's do it.
layout_overflowing_david:
id: <%= ActiveRecord::FixtureSet.identify("layout_overflowing_david_rich_text", :uuid) %>
record: layout_overflowing_david_uuid (Comment)
name: body
body: The text is overflowing the container.
+3
View File
@@ -0,0 +1,3 @@
jz_assignments_jz:
assignee_id: <%= ActiveRecord::FixtureSet.identify("jz", :uuid) %>
filter_id: <%= ActiveRecord::FixtureSet.identify("jz_assignments", :uuid) %>
+2 -1
View File
@@ -1,2 +1,3 @@
logo:
card: logo
id: <%= ActiveRecord::FixtureSet.identify("logo_engagement", :uuid) %>
card: logo_uuid
+2 -1
View File
@@ -1,2 +1,3 @@
logo:
card: logo
id: <%= ActiveRecord::FixtureSet.identify("logo_goldness", :uuid) %>
card: logo_uuid
-2
View File
@@ -1,8 +1,6 @@
jz_assignments:
id: <%= ActiveRecord::FixtureSet.identify("jz_assignments", :uuid) %>
creator: david_uuid
tags: mobile
assignees: jz
fields: <%= { indexed_by: :all, sorted_by: :newest }.to_json %>
params_digest: <%= Filter.digest_params({ indexed_by: :all, sorted_by: :newest, tag_ids: [ ActiveRecord::FixtureSet.identify("mobile", :uuid) ], assignee_ids: [ ActiveRecord::FixtureSet.identify("jz", :uuid) ] }) %>
account: 37s_uuid
+3
View File
@@ -0,0 +1,3 @@
jz_assignments_mobile:
filter_id: <%= ActiveRecord::FixtureSet.identify("jz_assignments", :uuid) %>
tag_id: <%= ActiveRecord::FixtureSet.identify("mobile", :uuid) %>
+8 -4
View File
@@ -2,17 +2,21 @@ _fixture:
model_class: User::Settings
david_settings:
user: david
id: <%= ActiveRecord::FixtureSet.identify("david_settings", :uuid) %>
user: david_uuid
bundle_email_frequency: never
jz_settings:
user: jz
id: <%= ActiveRecord::FixtureSet.identify("jz_settings", :uuid) %>
user: jz_uuid
bundle_email_frequency: never
kevin_settings:
user: kevin
id: <%= ActiveRecord::FixtureSet.identify("kevin_settings", :uuid) %>
user: kevin_uuid
bundle_email_frequency: never
system_settings:
user: system
id: <%= ActiveRecord::FixtureSet.identify("system_settings", :uuid) %>
user: system_uuid
bundle_email_frequency: never
+4 -2
View File
@@ -1,11 +1,13 @@
# Read about fixtures at https://api.rubyonrails.org/classes/ActiveRecord/FixtureSet.html
active_webhook_tracker:
webhook: active
id: <%= ActiveRecord::FixtureSet.identify("active_webhook_tracker", :uuid) %>
webhook: active_uuid
consecutive_failures_count: 1
first_failure_at: <%= 1.hour.ago %>
inactive_webhook_tracker:
webhook: inactive
id: <%= ActiveRecord::FixtureSet.identify("inactive_webhook_tracker", :uuid) %>
webhook: inactive_uuid
consecutive_failures_count: 1
first_failure_at: <%= 1.hour.ago %>
+15 -10
View File
@@ -1,40 +1,45 @@
# Read about fixtures at https://api.rubyonrails.org/classes/ActiveRecord/FixtureSet.html
successfully_completed:
webhook: active
event: logo_published
id: <%= ActiveRecord::FixtureSet.identify("successfully_completed_delivery", :uuid) %>
webhook: active_uuid
event: logo_published_uuid
state: completed
request: '<%= { headers: {} }.to_json %>'
response: '<%= { code: 200, headers: {} }.to_json %>'
created_at: <%= 1.week.ago %>
unsuccessfully_completed:
webhook: active
event: logo_assignment_jz
id: <%= ActiveRecord::FixtureSet.identify("unsuccessfully_completed_delivery", :uuid) %>
webhook: active_uuid
event: logo_assignment_jz_uuid
state: completed
request: '<%= { headers: {} }.to_json %>'
response: '<%= { code: 422, headers: {} }.to_json %>'
created_at: <%= 1.week.ago + 1.hour %>
errored:
webhook: active
event: layout_published
id: <%= ActiveRecord::FixtureSet.identify("errored_delivery", :uuid) %>
webhook: active_uuid
event: layout_published_uuid
state: errored
request: '<%= { headers: {} }.to_json %>'
response: '<%= { error: "destination_unreachable" }.to_json %>'
created_at: <%= 1.week.ago %>
pending:
webhook: active
event: shipping_closed
id: <%= ActiveRecord::FixtureSet.identify("pending_delivery", :uuid) %>
webhook: active_uuid
event: shipping_closed_uuid
state: pending
request: null
response: null
created_at: <%= 2.day.ago %>
in_progress:
webhook: active
event: logo_assignment_km
id: <%= ActiveRecord::FixtureSet.identify("in_progress_delivery", :uuid) %>
webhook: active_uuid
event: logo_assignment_km_uuid
state: in_progress
request: null
response: null
+5 -5
View File
@@ -85,24 +85,24 @@ class CardTest < ActiveSupport::TestCase
end
test "open" do
assert_equal cards(:logo, :layout, :text, :buy_domain), Card.open
assert_same_elements cards(:logo, :layout, :text, :buy_domain), Card.open
end
test "card_unassigned" do
assert_equal cards(:shipping, :text, :buy_domain), Card.unassigned
assert_same_elements cards(:shipping, :text, :buy_domain), Card.unassigned
end
test "assigned to" do
assert_equal cards(:logo, :layout), Card.assigned_to(users(:jz))
assert_same_elements cards(:logo, :layout), Card.assigned_to(users(:jz))
end
test "assigned by" do
assert_equal cards(:layout, :logo), Card.assigned_by(users(:david))
assert_same_elements cards(:layout, :logo), Card.assigned_by(users(:david))
end
test "in board" do
new_board = Board.create! name: "New Board", creator: users(:david)
assert_equal cards(:logo, :shipping, :layout, :text, :buy_domain), Card.where(board: boards(:writebook))
assert_same_elements cards(:logo, :shipping, :layout, :text, :buy_domain), Card.where(board: boards(:writebook))
assert_empty Card.where(board: new_board)
end