Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Move factories into a single file

  • Loading branch information...
commit 2c482ea66ae94c5add6c264452d412f34c330899 1 parent 0bd1f16
@jordanbyron jordanbyron authored
View
87 test/factories.rb
@@ -0,0 +1,87 @@
+FactoryGirl.define do
+ factory :heard_about_clinic do |f|
+ f.sequence(:reason) { |n| "Heard about Clinic \##{n}" }
+ end
+
+ factory :patient_assignment do
+ patient
+ treatment_area
+ end
+
+ factory :patient do
+ first_name { Faker::Name.first_name }
+ last_name { Faker::Name.last_name }
+ date_of_birth { Date.today - rand(100).years }
+ sex { %w( M F ).shuffle.first }
+ race { "Caucasian/White" }
+ chief_complaint { "Cleaning" }
+ last_dental_visit { "First Time" }
+ travel_time { 1 + rand(90) }
+ street { Faker::Address.street_address }
+ city { Faker::Address.city }
+ state { Faker::Address.state_abbr }
+ zip { Faker::Address.zip_code }
+
+ # Faker::PhoneNumber includes invalid formats like "###-###-#### x###"
+ phone { Faker::PhoneNumber.phone_number.split(" ").first }
+
+ survey
+ end
+
+ factory :survey do
+ told_needed_more_dental_treatment true
+ heard_about_clinic "Social Media"
+ has_place_to_be_seen_for_dental_care false
+ no_insurance true
+ end
+
+ factory :patient_flow do |pf|
+ pf.area_id { 1 + rand(5) }
+ pf.association :patient
+ pf.created_at { Time.current.utc }
+ end
+
+ factory :prescription do
+ daily_dose = 1 + Kernel.rand(3)
+ days = [5, 7, 10, 14].shuffle.first
+
+ name { Faker::Lorem.words(1 + rand(2)).join(" ").titlecase }
+ cost { 3 + rand(25) - 0.01 }
+ dosage { "#{ (1 + rand(5)) * 100 } mg" }
+ quantity { daily_dose * days }
+ strength { "#{ daily_dose } TID x #{ days } days" }
+ end
+
+ factory :procedure do
+ description { Faker::Lorem.words(1 + rand(4)).join(" ").titleize }
+ code { rand(1000) }
+ requires_tooth_number false
+ requires_surface_code false
+ cost { rand(500) }
+ end
+
+ factory :race do |f|
+ f.sequence(:category) { |n| "Race \##{n}" }
+ end
+
+ factory :treatment_area do |f|
+ f.sequence(:name) { |n| "Area ##{n}" }
+ capacity 20
+ end
+
+ factory :procedure_treatment_area_mapping do
+ treatment_area
+ procedure
+ end
+
+ factory :treatment do |f|
+ f.sequence(:name) { |n| "Treatment \##{n}" }
+ end
+
+ factory :user do
+ login 'check_in'
+ user_type UserType::CHECKIN
+ password 'temp123'
+ password_confirmation 'temp123'
+ end
+end
View
5 test/factories/heard_about_clinic_factory.rb
@@ -1,5 +0,0 @@
-FactoryGirl.define do
- factory :heard_about_clinic do |f|
- f.sequence(:reason) { |n| "Heard about Clinic \##{n}" }
- end
-end
View
6 test/factories/patient_assignment_factory.rb
@@ -1,6 +0,0 @@
-FactoryGirl.define do
- factory :patient_assignment do
- patient
- treatment_area
- end
-end
View
28 test/factories/patient_factory.rb
@@ -1,28 +0,0 @@
-FactoryGirl.define do
- factory :patient do
- first_name { Faker::Name.first_name }
- last_name { Faker::Name.last_name }
- date_of_birth { Date.today - rand(100).years }
- sex { %w( M F ).shuffle.first }
- race { "Caucasian/White" }
- chief_complaint { "Cleaning" }
- last_dental_visit { "First Time" }
- travel_time { 1 + rand(90) }
- street { Faker::Address.street_address }
- city { Faker::Address.city }
- state { Faker::Address.state_abbr }
- zip { Faker::Address.zip_code }
-
- # Faker::PhoneNumber includes invalid formats like "###-###-#### x###"
- phone { Faker::PhoneNumber.phone_number.split(" ").first }
-
- survey
- end
-
- factory :survey do
- told_needed_more_dental_treatment true
- heard_about_clinic "Social Media"
- has_place_to_be_seen_for_dental_care false
- no_insurance true
- end
-end
View
7 test/factories/patient_flow_factories.rb
@@ -1,7 +0,0 @@
-FactoryGirl.define do
- factory :patient_flow do |pf|
- pf.area_id { 1 + rand(5) }
- pf.association :patient
- pf.created_at { Time.current.utc }
- end
-end
View
12 test/factories/prescription_factories.rb
@@ -1,12 +0,0 @@
-FactoryGirl.define do
- factory :prescription do
- daily_dose = 1 + Kernel.rand(3)
- days = [5, 7, 10, 14].shuffle.first
-
- name { Faker::Lorem.words(1 + rand(2)).join(" ").titlecase }
- cost { 3 + rand(25) - 0.01 }
- dosage { "#{ (1 + rand(5)) * 100 } mg" }
- quantity { daily_dose * days }
- strength { "#{ daily_dose } TID x #{ days } days" }
- end
-end
View
9 test/factories/procedure_factories.rb
@@ -1,9 +0,0 @@
-FactoryGirl.define do
- factory :procedure do
- description { Faker::Lorem.words(1 + rand(4)).join(" ").titleize }
- code { rand(1000) }
- requires_tooth_number false
- requires_surface_code false
- cost { rand(500) }
- end
-end
View
5 test/factories/race_factory.rb
@@ -1,5 +0,0 @@
-FactoryGirl.define do
- factory :race do |f|
- f.sequence(:category) { |n| "Race \##{n}" }
- end
-end
View
11 test/factories/treatment_area_factory.rb
@@ -1,11 +0,0 @@
-FactoryGirl.define do
- factory :treatment_area do |f|
- f.sequence(:name) { |n| "Area ##{n}" }
- capacity 20
- end
-
- factory :procedure_treatment_area_mapping do
- treatment_area
- procedure
- end
-end
View
5 test/factories/treatment_factory.rb
@@ -1,5 +0,0 @@
-FactoryGirl.define do
- factory :treatment do |f|
- f.sequence(:name) { |n| "Treatment \##{n}" }
- end
-end
View
8 test/factories/user_factory.rb
@@ -1,8 +0,0 @@
-FactoryGirl.define do
- factory :user do
- login 'check_in'
- user_type UserType::CHECKIN
- password 'temp123'
- password_confirmation 'temp123'
- end
-end
Please sign in to comment.
Something went wrong with that request. Please try again.