Skip to content

Commit

Permalink
Improve factories related to english language
Browse files Browse the repository at this point in the history
This ensures that when used the factories better represent a real
application.
  • Loading branch information
thomasleese committed Apr 4, 2024
1 parent 59e4b1a commit 6d8a6fe
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
8 changes: 7 additions & 1 deletion spec/factories/application_forms.rb
Original file line number Diff line number Diff line change
Expand Up @@ -300,6 +300,8 @@
end

trait :with_english_language_medium_of_instruction do
english_language_citizenship_exempt { false }
english_language_qualification_exempt { false }
english_language_proof_method { "medium_of_instruction" }
english_language_status { "completed" }

Expand All @@ -314,7 +316,6 @@

trait :with_english_language_proficiency_document do
with_english_language_provider
english_language_status { "completed" }

after(:create) do |application_form, _evaluator|
create(
Expand All @@ -325,6 +326,8 @@
end

trait :with_english_language_provider do
english_language_citizenship_exempt { false }
english_language_qualification_exempt { false }
english_language_proof_method { "provider" }
english_language_provider do
EnglishLanguageProvider.all.sample || create(:english_language_provider)
Expand All @@ -334,6 +337,8 @@
end

trait :with_english_language_other_provider do
english_language_citizenship_exempt { false }
english_language_qualification_exempt { false }
english_language_proof_method { "provider" }
english_language_provider_other { true }
english_language_status { "completed" }
Expand All @@ -352,6 +357,7 @@
end

trait :with_english_language_exemption_by_qualification do
english_language_citizenship_exempt { false }
english_language_qualification_exempt { true }
english_language_status { "completed" }
end
Expand Down
2 changes: 1 addition & 1 deletion spec/factories/work_histories.rb
Original file line number Diff line number Diff line change
Expand Up @@ -42,11 +42,11 @@
city { Faker::Address.city }
contact_job { Faker::Job.title }
contact_name { Faker::Name.name }
contact_email { Faker::Internet.email }
hours_per_week { Faker::Number.between(from: 20, to: 40) }
job { Faker::Job.title }
school_name { Faker::Educator.primary_school }
sequence :country_code, Country::CODES.cycle
sequence(:contact_email) { |n| "school#{n}@example.org" }
start_date { Faker::Date.between(from: 5.years.ago, to: 9.months.ago) }
still_employed
end
Expand Down

0 comments on commit 6d8a6fe

Please sign in to comment.