Deterministic fixture UUIDs
This commit is contained in:
committed by
Mike Dalessio
parent
1959e15f7e
commit
63f8a9af78
@@ -5,7 +5,7 @@ class Board::AccessibleTest < ActiveSupport::TestCase
|
||||
boards(:writebook).update! all_access: false
|
||||
|
||||
boards(:writebook).accesses.revise granted: users(:david, :jz), revoked: users(:kevin)
|
||||
assert_equal users(:david, :jz), boards(:writebook).users
|
||||
assert_equal users(:david, :jz).to_set, boards(:writebook).users.to_set
|
||||
|
||||
boards(:writebook).accesses.grant_to users(:kevin)
|
||||
assert_includes boards(:writebook).users.reload, users(:kevin)
|
||||
|
||||
@@ -39,7 +39,7 @@ class Notifier::EventNotifierTest < ActiveSupport::TestCase
|
||||
|
||||
Notifier.for(events(:logo_published)).notify
|
||||
|
||||
assert_equal cards(:logo), Notification.last.source.eventable
|
||||
assert_equal cards(:logo), Notification.order(created_at: :desc).first.source.eventable
|
||||
end
|
||||
|
||||
test "assignment events only create a notification for the assignee" do
|
||||
|
||||
+3
-2
@@ -80,8 +80,9 @@ module FixturesTestHelper
|
||||
label = label.to_s.delete_suffix("_uuid")
|
||||
end
|
||||
|
||||
return super(label, column_type) unless column_type == :uuid
|
||||
UuidPrimaryKey.uuid_to_base36(super(label, column_type))
|
||||
# Rails passes :string for varchar columns, so handle both :uuid and :string
|
||||
return super(label, column_type) unless column_type.in?([:uuid, :string])
|
||||
UuidPrimaryKey.generate_fixture_uuid(label)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user