Files
project-work/worker-toolkit-stocks-in-the-future/repo/test/factories/quarters.rb
Eric Bell 392781f7aa chore: init commit
in worker.../repo/GITFOLDER.zip is the .git folder.
2026-08-11 14:44:09 -04:00

19 lines
557 B
Ruby

# frozen_string_literal: true
# test/factories/quarters.rb
# SchoolYear auto-creates 4 quarters via after_create, so create(:quarter) finds
# the existing quarter rather than inserting a new one (which would violate the
# uniqueness constraint on number scoped to school_year).
FactoryBot.define do
factory :quarter do
association :school_year
number { 1 }
name { "Quarter #{number}" }
to_create do |instance|
instance.id = instance.school_year.quarters.find_by!(number: instance.number).id
instance.reload
end
end
end