Fix this test without changing app code
This commit is contained in:
committed by
Mike Dalessio
parent
63f8a9af78
commit
e9e68646e3
@@ -2,6 +2,6 @@ module Account::Seedeable
|
||||
extend ActiveSupport::Concern
|
||||
|
||||
def setup_customer_template
|
||||
Account::Seeder.new(self, users.active.order(created_at: :asc).first).seed
|
||||
Account::Seeder.new(self, users.active.first).seed
|
||||
end
|
||||
end
|
||||
|
||||
@@ -21,7 +21,7 @@ class Account::Seeder
|
||||
|
||||
private
|
||||
def session
|
||||
creator.identity.sessions.order(created_at: :desc).first
|
||||
creator.identity.sessions.last
|
||||
end
|
||||
|
||||
def populate
|
||||
|
||||
@@ -13,7 +13,9 @@ module UuidPrimaryKey
|
||||
def self.generate_fixture_uuid(label)
|
||||
# Generate deterministic UUIDv7 for fixtures that sorts by fixture ID
|
||||
# This allows .first/.last to work as expected in tests
|
||||
fixture_int = Digest::MD5.hexdigest("fixtures#{label}").hex % (2**31)
|
||||
# Use the same CRC32 algorithm as Rails' default fixture ID generation
|
||||
# so that UUIDs sort in the same order as integer IDs
|
||||
fixture_int = Zlib.crc32("fixtures/#{label}") % (2**30 - 1)
|
||||
|
||||
# Use fixture_int as second offset from a fixed base time (1 year before 2025-01-01)
|
||||
# This ensures all fixtures are in the past, and new test records are newest
|
||||
|
||||
Vendored
+6
@@ -3,3 +3,9 @@ david:
|
||||
|
||||
kevin:
|
||||
identity: kevin
|
||||
|
||||
jz:
|
||||
identity: jz
|
||||
|
||||
jason:
|
||||
identity: jason
|
||||
|
||||
Reference in New Issue
Block a user