stbaldricks 8.1.0 → 8.2.1.alpha.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (107) hide show
  1. checksums.yaml +4 -4
  2. data/lib/stbaldricks/endpoints/lib/entity.rb +1 -1
  3. data/lib/stbaldricks/entities/contact_group.rb +0 -1
  4. data/lib/stbaldricks/entities/lib/base.rb +6 -0
  5. data/lib/stbaldricks/entities/response.rb +2 -2
  6. data/lib/stbaldricks/patches/boolean.rb +2 -0
  7. data/lib/stbaldricks/patches/float.rb +2 -0
  8. data/lib/stbaldricks/patches/integer.rb +2 -0
  9. data/lib/stbaldricks/patches/nil.rb +2 -0
  10. data/lib/stbaldricks/patches/string.rb +2 -0
  11. data/lib/stbaldricks/version.rb +1 -1
  12. data/lib/stbaldricks_factories.rb +5 -0
  13. data/spec/factories/address.rb +14 -0
  14. data/spec/factories/campaign/totals.rb +9 -0
  15. data/spec/factories/campaign.rb +9 -0
  16. data/spec/factories/challenge.rb +19 -0
  17. data/spec/factories/challenger.rb +27 -0
  18. data/spec/factories/collection.rb +17 -0
  19. data/spec/factories/contact.rb +18 -0
  20. data/spec/factories/contact_group.rb +18 -0
  21. data/spec/factories/diagnosis.rb +12 -0
  22. data/spec/factories/disease.rb +11 -0
  23. data/spec/factories/donation/participant.rb +27 -0
  24. data/spec/factories/donation.rb +68 -0
  25. data/spec/factories/donor.rb +13 -0
  26. data/spec/factories/email_address.rb +11 -0
  27. data/spec/factories/error.rb +9 -0
  28. data/spec/factories/event/coach_tracking/coaching_interactions.rb +12 -0
  29. data/spec/factories/event/coach_tracking/plaque.rb +12 -0
  30. data/spec/factories/event/coach_tracking/proceeds.rb +12 -0
  31. data/spec/factories/event/coach_tracking.rb +18 -0
  32. data/spec/factories/event/contacts/contact.rb +17 -0
  33. data/spec/factories/event/contacts/name_pieces.rb +12 -0
  34. data/spec/factories/event/contacts.rb +16 -0
  35. data/spec/factories/event/photos.rb +12 -0
  36. data/spec/factories/event/totals.rb +15 -0
  37. data/spec/factories/event/venue/location.rb +18 -0
  38. data/spec/factories/event/venue/social.rb +16 -0
  39. data/spec/factories/event/venue.rb +16 -0
  40. data/spec/factories/event.rb +43 -0
  41. data/spec/factories/event_application.rb +34 -0
  42. data/spec/factories/event_supporter.rb +19 -0
  43. data/spec/factories/fund.rb +18 -0
  44. data/spec/factories/fundraiser/photos.rb +12 -0
  45. data/spec/factories/fundraiser/policies.rb +11 -0
  46. data/spec/factories/fundraiser/totals.rb +11 -0
  47. data/spec/factories/fundraiser.rb +24 -0
  48. data/spec/factories/fundraising_page.rb +29 -0
  49. data/spec/factories/grant.rb +22 -0
  50. data/spec/factories/grant_institution.rb +17 -0
  51. data/spec/factories/institution.rb +18 -0
  52. data/spec/factories/kid/custom_institution.rb +12 -0
  53. data/spec/factories/kid.rb +70 -0
  54. data/spec/factories/kid_honor.rb +16 -0
  55. data/spec/factories/kid_institution.rb +17 -0
  56. data/spec/factories/lib/helpers.rb +7 -0
  57. data/spec/factories/location.rb +17 -0
  58. data/spec/factories/memorial/photos.rb +14 -0
  59. data/spec/factories/memorial/totals.rb +11 -0
  60. data/spec/factories/memorial/tribute.rb +19 -0
  61. data/spec/factories/memorial.rb +22 -0
  62. data/spec/factories/message.rb +31 -0
  63. data/spec/factories/name_pieces.rb +24 -0
  64. data/spec/factories/newsletter_recipient.rb +13 -0
  65. data/spec/factories/organization/addresses.rb +16 -0
  66. data/spec/factories/organization/email_addresses.rb +14 -0
  67. data/spec/factories/organization/phone_numbers.rb +14 -0
  68. data/spec/factories/organization.rb +34 -0
  69. data/spec/factories/page.rb +5 -0
  70. data/spec/factories/participant/photos.rb +14 -0
  71. data/spec/factories/participant/policies.rb +12 -0
  72. data/spec/factories/participant/rankings/ranking.rb +12 -0
  73. data/spec/factories/participant/rankings.rb +16 -0
  74. data/spec/factories/participant/roles/role.rb +150 -0
  75. data/spec/factories/participant/roles.rb +35 -0
  76. data/spec/factories/participant/totals.rb +11 -0
  77. data/spec/factories/participant.rb +89 -0
  78. data/spec/factories/payment.rb +13 -0
  79. data/spec/factories/permissions.rb +12 -0
  80. data/spec/factories/person/addresses.rb +16 -0
  81. data/spec/factories/person/email_addresses.rb +14 -0
  82. data/spec/factories/person/phone_numbers.rb +14 -0
  83. data/spec/factories/person/policies.rb +13 -0
  84. data/spec/factories/person.rb +22 -0
  85. data/spec/factories/phone.rb +11 -0
  86. data/spec/factories/photo.rb +11 -0
  87. data/spec/factories/photos.rb +9 -0
  88. data/spec/factories/recurring_gift.rb +22 -0
  89. data/spec/factories/researcher.rb +15 -0
  90. data/spec/factories/response.rb +38 -0
  91. data/spec/factories/search_event.rb +19 -0
  92. data/spec/factories/search_fundraiser.rb +15 -0
  93. data/spec/factories/search_kid.rb +13 -0
  94. data/spec/factories/search_participant.rb +15 -0
  95. data/spec/factories/search_team.rb +13 -0
  96. data/spec/factories/shave_schedule/time_selection_permissions.rb +12 -0
  97. data/spec/factories/shave_schedule.rb +33 -0
  98. data/spec/factories/team/photos.rb +12 -0
  99. data/spec/factories/team/rankings/ranking.rb +12 -0
  100. data/spec/factories/team/rankings.rb +15 -0
  101. data/spec/factories/team/totals.rb +14 -0
  102. data/spec/factories/team.rb +43 -0
  103. data/spec/factories/third_party_media.rb +12 -0
  104. data/spec/factories/treatment_status.rb +10 -0
  105. data/spec/factories/user.rb +14 -0
  106. data/spec/factories/venue.rb +15 -0
  107. metadata +405 -5
@@ -0,0 +1,150 @@
1
+ require_relative '../../lib/helpers'
2
+
3
+ FactoryBot.define do
4
+ factory :participant_roles_shavee, class: SBF::Client::Participant::Roles::Shavee do
5
+ skip_create
6
+
7
+ initialize_with do
8
+ new(attributes)
9
+ end
10
+
11
+ after :build do |role, evaluator|
12
+ role.status = SBF::Client::Participant::Roles::Status::ACTIVE if unpopulated?(evaluator, :status)
13
+ end
14
+ end
15
+
16
+ factory :participant_roles_volunteer, class: SBF::Client::Participant::Roles::Volunteer do
17
+ skip_create
18
+
19
+ initialize_with do
20
+ new(attributes)
21
+ end
22
+
23
+ after :build do |role, evaluator|
24
+ role.status = SBF::Client::Participant::Roles::Status::ACTIVE if unpopulated?(evaluator, :status)
25
+ end
26
+ end
27
+
28
+ factory :participant_roles_barber_coordinator, class: SBF::Client::Participant::Roles::BarberCoordinator do
29
+ skip_create
30
+
31
+ initialize_with do
32
+ new(attributes)
33
+ end
34
+
35
+ after :build do |role, evaluator|
36
+ role.status = SBF::Client::Participant::Roles::Status::ACTIVE if unpopulated?(evaluator, :status)
37
+ end
38
+ end
39
+
40
+ factory :participant_roles_shavee_recruiter, class: SBF::Client::Participant::Roles::ShaveeRecruiter do
41
+ skip_create
42
+
43
+ initialize_with do
44
+ new(attributes)
45
+ end
46
+
47
+ after :build do |role, evaluator|
48
+ role.status = SBF::Client::Participant::Roles::Status::ACTIVE if unpopulated?(evaluator, :status)
49
+ end
50
+ end
51
+
52
+ factory :participant_roles_team_captain, class: SBF::Client::Participant::Roles::TeamCaptain do
53
+ skip_create
54
+
55
+ initialize_with do
56
+ new(attributes)
57
+ end
58
+
59
+ after :build do |role, evaluator|
60
+ role.status = SBF::Client::Participant::Roles::Status::ACTIVE if unpopulated?(evaluator, :status)
61
+ end
62
+ end
63
+
64
+ factory :participant_roles_organizer, class: SBF::Client::Participant::Roles::Organizer do
65
+ skip_create
66
+
67
+ initialize_with do
68
+ new(attributes)
69
+ end
70
+
71
+ after :build do |role, evaluator|
72
+ role.status = SBF::Client::Participant::Roles::Status::ACTIVE if unpopulated?(evaluator, :status)
73
+ end
74
+ end
75
+
76
+ factory :participant_roles_treasurer, class: SBF::Client::Participant::Roles::Treasurer do
77
+ skip_create
78
+
79
+ initialize_with do
80
+ new(attributes)
81
+ end
82
+
83
+ after :build do |role, evaluator|
84
+ role.status = SBF::Client::Participant::Roles::Status::ACTIVE if unpopulated?(evaluator, :status)
85
+ end
86
+ end
87
+
88
+ factory :participant_roles_barber, class: SBF::Client::Participant::Roles::Barber do
89
+ skip_create
90
+
91
+ initialize_with do
92
+ new(attributes)
93
+ end
94
+
95
+ after :build do |role, evaluator|
96
+ role.status = SBF::Client::Participant::Roles::Status::ACTIVE if unpopulated?(evaluator, :status)
97
+ role.license = {number: 'License Number', organization: 'License Organization'}
98
+ role.salon = {name: 'Salon Name', phone: {number: '444-333-8888'}}
99
+ end
100
+ end
101
+
102
+ factory :participant_roles_lead_treasurer, class: SBF::Client::Participant::Roles::Treasurer do
103
+ skip_create
104
+
105
+ initialize_with do
106
+ new(attributes)
107
+ end
108
+
109
+ status { SBF::Client::Participant::Roles::Status::ACTIVE }
110
+ is_lead { true }
111
+ end
112
+
113
+ factory :participant_roles_lead_organizer, class: SBF::Client::Participant::Roles::Organizer do
114
+ skip_create
115
+
116
+ initialize_with do
117
+ new(attributes)
118
+ end
119
+
120
+ status { SBF::Client::Participant::Roles::Status::ACTIVE }
121
+ is_lead { true }
122
+ end
123
+
124
+ factory :participant_roles_organizer_role, class: SBF::Client::Participant::Roles::Organizer do
125
+ skip_create
126
+
127
+ initialize_with do
128
+ new(attributes)
129
+ end
130
+
131
+ status { SBF::Client::Participant::Roles::Status::ACTIVE }
132
+
133
+ after :build do |organizer|
134
+ organizer.policies = build(:participant_roles_organizer_role_policies)
135
+ end
136
+ end
137
+
138
+ factory :participant_roles_organizer_role_policies, class: SBF::Client::Participant::Roles::Organizer::Policies do
139
+ skip_create
140
+
141
+ initialize_with do
142
+ new(attributes)
143
+ end
144
+
145
+ agreement_received_date { Time.now.to_s }
146
+ coaches_questionnaire_received_date { Time.now.to_s }
147
+ is_revenue_waiver_accepted { true }
148
+ is_host_agreement_waiver_accepted { true }
149
+ end
150
+ end
@@ -0,0 +1,35 @@
1
+ FactoryBot.define do
2
+ factory :participant_roles, class: SBF::Client::Participant::Roles do
3
+ skip_create
4
+
5
+ initialize_with do
6
+ new(attributes)
7
+ end
8
+
9
+ transient do
10
+ shavee { true }
11
+ volunteer { nil }
12
+ shavee_recruiter { nil }
13
+ team_captain { nil }
14
+ barber_coordinator { nil }
15
+ organizer { nil }
16
+ lead_organizer { nil }
17
+ treasurer { nil }
18
+ lead_treasurer { nil }
19
+ barber { nil }
20
+ end
21
+
22
+ after :build do |roles, evaluator|
23
+ roles.shavee = build(:participant_roles_shavee) if evaluator.shavee
24
+ roles.volunteer = build(:participant_roles_volunteer) if evaluator.volunteer
25
+ roles.shavee_recruiter = build(:participant_roles_shavee_recruiter) if evaluator.shavee_recruiter
26
+ roles.team_captain = build(:participant_roles_team_captain) if evaluator.team_captain
27
+ roles.barber_coordinator = build(:participant_roles_barber_coordinator) if evaluator.barber_coordinator
28
+ roles.organizer = build(:participant_roles_lead_organizer) if evaluator.lead_organizer
29
+ roles.organizer = build(:participant_roles_organizer) if evaluator.organizer
30
+ roles.treasurer = build(:participant_roles_treasurer) if evaluator.treasurer
31
+ roles.treasurer = build(:participant_roles_lead_treasurer) if evaluator.lead_treasurer
32
+ roles.barber = build(:participant_roles_barber) if evaluator.barber
33
+ end
34
+ end
35
+ end
@@ -0,0 +1,11 @@
1
+ FactoryBot.define do
2
+ factory :participant_totals, class: SBF::Client::Participant::Totals do
3
+ skip_create
4
+
5
+ initialize_with do
6
+ new(attributes)
7
+ end
8
+
9
+ amount_raised { 0 }
10
+ end
11
+ end
@@ -0,0 +1,89 @@
1
+ require_relative 'lib/helpers'
2
+
3
+ FactoryBot.define do
4
+ factory :participant, class: SBF::Client::FullParticipant do
5
+ to_create { |it| raise "Failed to create #{it.class}: #{it.errors.details}" unless it.save }
6
+
7
+ initialize_with do
8
+ new(attributes)
9
+ end
10
+
11
+ fundraising_goal { 100 }
12
+ shave_time { Time.now.to_s }
13
+ model_type { 'person' }
14
+ fundraising_message { 'I am raising money for SBF' }
15
+ how_created { 'admin_control_panel' }
16
+
17
+ after :build do |participant, evaluator|
18
+ participant.person = build(:person) if unpopulated?(evaluator, :person)
19
+ if !unpopulated?(evaluator, :event) && evaluator.event.virtual?
20
+ participant.is_virtual = true
21
+ participant.shave_schedule = {date: Date.today + 30, time: '12:00:00'} if unpopulated?(evaluator, :shave_schedule)
22
+ end
23
+ end
24
+ end
25
+
26
+ factory :lead_organizer, class: SBF::Client::FullParticipant, parent: :participant do
27
+ after :build do |participant, evaluator|
28
+ participant.roles = build(:participant_roles, lead_organizer: true, shavee: false) if unpopulated?(evaluator, :roles)
29
+ end
30
+ end
31
+
32
+ factory :organizer, class: SBF::Client::FullParticipant, parent: :participant do
33
+ after :build do |participant, evaluator|
34
+ participant.roles = build(:participant_roles, organizer: true, shavee: false) if unpopulated?(evaluator, :roles)
35
+ end
36
+ end
37
+
38
+ factory :shavee, class: SBF::Client::FullParticipant, parent: :participant do
39
+ after :build do |participant, evaluator|
40
+ participant.roles = build(:participant_roles, shavee: true) if unpopulated?(evaluator, :roles)
41
+ end
42
+ end
43
+
44
+ factory :team_captain, class: SBF::Client::FullParticipant, parent: :participant do
45
+ after :build do |participant, evaluator|
46
+ # NOTE: The roles are being ignored on purpose. Do not change this until team create through the api works - and when
47
+ # that happens we will need to re-write the team factory. Instead we are using the move_participant_to_team route
48
+ # which will create the roles for us.
49
+ # participant.roles = build(:participant_roles, team_captain: true, shavee: true) if unpopulated?(evaluator, :roles)
50
+ participant.roles = build(:participant_roles, team_captain: false, shavee: true) if unpopulated?(evaluator, :roles)
51
+ end
52
+ end
53
+
54
+ factory :shavee_recruiter, class: SBF::Client::FullParticipant, parent: :participant do
55
+ after :build do |participant, evaluator|
56
+ participant.roles = build(:participant_roles, shavee_recruiter: true, shavee: false) if unpopulated?(evaluator, :roles)
57
+ end
58
+ end
59
+
60
+ factory :treasurer, class: SBF::Client::FullParticipant, parent: :participant do
61
+ after :build do |participant, evaluator|
62
+ participant.roles = build(:participant_roles, treasurer: true, shavee: false) if unpopulated?(evaluator, :roles)
63
+ end
64
+ end
65
+
66
+ factory :lead_treasurer, class: SBF::Client::FullParticipant, parent: :participant do
67
+ after :build do |participant, evaluator|
68
+ participant.roles = build(:participant_roles, lead_treasurer: true, shavee: false) if unpopulated?(evaluator, :roles)
69
+ end
70
+ end
71
+
72
+ factory :barber_coordinator, class: SBF::Client::FullParticipant, parent: :participant do
73
+ after :build do |participant, evaluator|
74
+ participant.roles = build(:participant_roles, barber_coordinator: true, shavee: false) if unpopulated?(evaluator, :roles)
75
+ end
76
+ end
77
+
78
+ factory :barber, class: SBF::Client::FullParticipant, parent: :participant do
79
+ after :build do |participant, evaluator|
80
+ participant.roles = build(:participant_roles, barber: true, shavee: false) if unpopulated?(evaluator, :roles)
81
+ end
82
+ end
83
+
84
+ factory :volunteer, class: SBF::Client::FullParticipant, parent: :participant do
85
+ after :build do |participant, evaluator|
86
+ participant.roles = build(:participant_roles, volunteer: true, shavee: false) if unpopulated?(evaluator, :roles)
87
+ end
88
+ end
89
+ end
@@ -0,0 +1,13 @@
1
+ FactoryBot.define do
2
+ factory :payment, class: SBF::Client::Payment do
3
+ skip_create
4
+
5
+ initialize_with do
6
+ new(attributes)
7
+ end
8
+ end
9
+
10
+ factory :subscription_credit_card_payment, class: SBF::Client::Payment::SubscriptionCreditCardDetails, parent: :payment do
11
+ type { SBF::Client::Payment::Type::CREDIT_CARD }
12
+ end
13
+ end
@@ -0,0 +1,12 @@
1
+ FactoryBot.define do
2
+ factory :permissions, class: SBF::Client::Permissions do
3
+ skip_create
4
+
5
+ initialize_with do
6
+ new(attributes)
7
+ end
8
+
9
+ is_owner { false }
10
+ permission_ids { [] }
11
+ end
12
+ end
@@ -0,0 +1,16 @@
1
+ require_relative '../lib/helpers'
2
+
3
+ FactoryBot.define do
4
+ factory :person_addresses, class: SBF::Client::Person::Addresses do
5
+ skip_create
6
+
7
+ initialize_with do
8
+ new(attributes)
9
+ end
10
+
11
+ after :build do |addresses, evaluator|
12
+ addresses.primary = build(:address) if unpopulated?(evaluator, :primary)
13
+ addresses.secondary = build(:address) if unpopulated?(evaluator, :secondary)
14
+ end
15
+ end
16
+ end
@@ -0,0 +1,14 @@
1
+ FactoryBot.define do
2
+ factory :person_email_addresses, class: SBF::Client::Person::EmailAddresses do
3
+ skip_create
4
+
5
+ initialize_with do
6
+ new(attributes)
7
+ end
8
+
9
+ after :build do |email_addresses|
10
+ email_addresses.primary = build(:email_address)
11
+ email_addresses.secondary = build(:email_address)
12
+ end
13
+ end
14
+ end
@@ -0,0 +1,14 @@
1
+ FactoryBot.define do
2
+ factory :person_phone_numbers, class: SBF::Client::Person::PhoneNumbers do
3
+ skip_create
4
+
5
+ initialize_with do
6
+ new(attributes)
7
+ end
8
+
9
+ after :build do |phone_numbers|
10
+ phone_numbers.primary = build(:phone)
11
+ phone_numbers.secondary = build(:phone)
12
+ end
13
+ end
14
+ end
@@ -0,0 +1,13 @@
1
+ FactoryBot.define do
2
+ factory :policies, class: SBF::Client::Person::Policies do
3
+ skip_create
4
+
5
+ initialize_with do
6
+ new(attributes)
7
+ end
8
+
9
+ is_photo_policy_accepted { Time.now.to_s }
10
+ background_check_date { Time.now.to_s }
11
+ background_check_url { 'http://example.com' }
12
+ end
13
+ end
@@ -0,0 +1,22 @@
1
+ require_relative 'lib/helpers'
2
+
3
+ FactoryBot.define do
4
+ factory :person, class: SBF::Client::FullPerson do
5
+ to_create { |it| raise "Failed to create #{it.class}: #{it.errors.details}" unless it.save }
6
+
7
+ initialize_with do
8
+ new(attributes)
9
+ end
10
+
11
+ after :build do |person, evaluator|
12
+ person.email_addresses = build(:person_email_addresses) if unpopulated?(evaluator, :email_addresses)
13
+ person.phone_numbers = build(:person_phone_numbers) if unpopulated?(evaluator, :phone_numbers)
14
+ person.name_pieces = build(:name_pieces) if unpopulated?(evaluator, :name_pieces)
15
+ person.policies = build(:policies) if unpopulated?(evaluator, :policies)
16
+ person.addresses = build(:person_addresses) if unpopulated?(evaluator, :addresses)
17
+ person.status = 'active' if unpopulated?(evaluator, :status)
18
+ person.type = SBF::Client::Person::Type::INDIVIDUAL if unpopulated?(evaluator, :type)
19
+ person.birthday = Faker::Date.birthday(19, 65).to_s if unpopulated?(evaluator, :birthday)
20
+ end
21
+ end
22
+ end
@@ -0,0 +1,11 @@
1
+ FactoryBot.define do
2
+ factory :phone, class: SBF::Client::Phone do
3
+ skip_create
4
+
5
+ initialize_with do
6
+ new(attributes)
7
+ end
8
+
9
+ number { "#{Faker::Number.number(3)}-#{Faker::Number.number(3)}-#{Faker::Number.number(4)}" }
10
+ end
11
+ end
@@ -0,0 +1,11 @@
1
+ FactoryBot.define do
2
+ factory :photo, class: SBF::Client::Photo do
3
+ skip_create
4
+
5
+ initialize_with do
6
+ new(attributes)
7
+ end
8
+
9
+ sequence(:id) { |n| n + 100 }
10
+ end
11
+ end
@@ -0,0 +1,9 @@
1
+ FactoryBot.define do
2
+ factory :photos, class: SBF::Client::Photos do
3
+ skip_create
4
+
5
+ initialize_with do
6
+ new(attributes)
7
+ end
8
+ end
9
+ end
@@ -0,0 +1,22 @@
1
+ require_relative 'lib/helpers'
2
+
3
+ FactoryBot.define do
4
+ factory :recurring_gift, class: SBF::Client::FullRecurringGift do
5
+ to_create { |it| raise "Failed to create #{it.class}: #{it.errors.details}" unless it.save }
6
+
7
+ initialize_with do
8
+ new(attributes)
9
+ end
10
+
11
+ amount { rand(10..100) }
12
+ status { SBF::Client::RecurringGift::Status::PENDING }
13
+ created_at { Date.today }
14
+ last_collected_at { Date.today }
15
+ is_unrecognized { false }
16
+
17
+ after :build do |recurring_gift, evaluator|
18
+ recurring_gift.donor = build(:person, status: SBF::Client::Person::Status::ACTIVE) if unpopulated?(evaluator, :donor)
19
+ recurring_gift.payment_details = build(:nonce_payment) if unpopulated?(evaluator, :payment_details)
20
+ end
21
+ end
22
+ end
@@ -0,0 +1,15 @@
1
+ require_relative 'lib/helpers'
2
+
3
+ FactoryBot.define do
4
+ factory :researcher, class: SBF::Client::Grant::FullResearcher do
5
+ to_create { |it| raise "Failed to create #{it.class}: #{it.errors.details}" unless it.save }
6
+
7
+ initialize_with do
8
+ new(attributes)
9
+ end
10
+
11
+ after :build do |researcher, evaluator|
12
+ researcher.name_pieces = build(:name_pieces) if unpopulated?(evaluator, :name_pieces)
13
+ end
14
+ end
15
+ end
@@ -0,0 +1,38 @@
1
+ FactoryBot.define do
2
+ factory :response, class: SBF::Client::Api::Response do
3
+ skip_create
4
+
5
+ transient do
6
+ # allow passing in results as an argument
7
+ results { nil }
8
+ total_count { nil }
9
+ end
10
+
11
+ after :build do |response, evaluator|
12
+ # Either set data to data passed in as an arg or an empty hash if no data arg
13
+ response.data = evaluator.data || {}
14
+
15
+ # Set data[:results] to the arg results
16
+ response.data[:results] = evaluator.results if evaluator.results
17
+
18
+ # Set data[:total_count] to the arg total_count
19
+ response.data[:total_count] = evaluator.total_count if evaluator.total_count
20
+ end
21
+
22
+ http_code { 200 }
23
+ end
24
+
25
+ factory :not_found, class: SBF::Client::Api::Response do
26
+ skip_create
27
+
28
+ data { nil }
29
+ http_code { 404 }
30
+ end
31
+
32
+ factory :unavailable, class: SBF::Client::Api::Response do
33
+ skip_create
34
+
35
+ data { nil }
36
+ http_code { 503 }
37
+ end
38
+ end
@@ -0,0 +1,19 @@
1
+ FactoryBot.define do
2
+ factory :search_event, class: SBF::Client::Search::Event do
3
+ skip_create
4
+
5
+ initialize_with do
6
+ new(attributes)
7
+ end
8
+
9
+ sequence(:event_id) { |n| n + 10_000 }
10
+ event_year { 2015 }
11
+ event_title { 'My Event Title' }
12
+ event_date { '2015-05-05' }
13
+ total_donations { 12_345 }
14
+ total_participants { 5 }
15
+ total_shavees { rand(10) }
16
+ address1 { '123 Main Street' }
17
+ closed_roles { [] }
18
+ end
19
+ end
@@ -0,0 +1,15 @@
1
+ FactoryBot.define do
2
+ factory :search_fundraiser, class: SBF::Client::Search::Fundraiser do
3
+ skip_create
4
+
5
+ initialize_with do
6
+ new(attributes)
7
+ end
8
+
9
+ sequence(:fundraiser_id) { |n| n }
10
+ sequence(:profile_id) { |n| n + 100 }
11
+ sequence(:team_id) { |n| n + 1000 }
12
+ sequence(:event_id) { |n| n + 10_000 }
13
+ event_year { 2014 }
14
+ end
15
+ end
@@ -0,0 +1,13 @@
1
+ FactoryBot.define do
2
+ factory :search_kid, class: SBF::Client::Search::Kid do
3
+ skip_create
4
+
5
+ initialize_with do
6
+ new(attributes)
7
+ end
8
+
9
+ sequence(:kid_id) { |n| n }
10
+ sequence(:treatment_status_slug) { |n| "Treatment status slug #{n}" }
11
+ sequence(:treatment_status_other) { |n| "Treatment status other #{n}" }
12
+ end
13
+ end
@@ -0,0 +1,15 @@
1
+ FactoryBot.define do
2
+ factory :search_participant, class: SBF::Client::Search::Participant do
3
+ skip_create
4
+
5
+ initialize_with do
6
+ new(attributes)
7
+ end
8
+
9
+ sequence(:participant_id) { |n| n }
10
+ sequence(:profile_id) { |n| n + 100 }
11
+ sequence(:team_id) { |n| n + 1000 }
12
+ sequence(:event_id) { |n| n + 10_000 }
13
+ event_year { 2014 }
14
+ end
15
+ end
@@ -0,0 +1,13 @@
1
+ FactoryBot.define do
2
+ factory :search_team, class: SBF::Client::Search::Team do
3
+ skip_create
4
+
5
+ initialize_with do
6
+ new(attributes)
7
+ end
8
+
9
+ sequence(:team_id) { |n| n + 10_000 }
10
+ sequence(:event_id) { |n| n + 10_000 }
11
+ event_year { 2014 }
12
+ end
13
+ end
@@ -0,0 +1,12 @@
1
+ FactoryBot.define do
2
+ factory :shave_schedule_time_selection_permissions, class: SBF::Client::ShaveSchedule::TimeSelectionPermissions do
3
+ skip_create
4
+
5
+ initialize_with do
6
+ new(attributes)
7
+ end
8
+
9
+ shavees { [] }
10
+ team_captains { [] }
11
+ end
12
+ end
@@ -0,0 +1,33 @@
1
+ require_relative 'lib/helpers'
2
+
3
+ FactoryBot.define do
4
+ factory :shave_schedule, class: SBF::Client::ShaveSchedule do
5
+ skip_create
6
+
7
+ initialize_with do
8
+ new(attributes)
9
+ end
10
+
11
+ start_time { '00:00:00' }
12
+ end_time { '23:59:59' }
13
+ number_of_seats { 50 }
14
+ shave_duration_in_minutes { 5 }
15
+ end
16
+ end
17
+
18
+ FactoryBot.define do
19
+ factory :shave_schedule_assignment, class: SBF::Client::ShaveSchedule::ShaveScheduleAssignment do
20
+ skip_create
21
+
22
+ initialize_with do
23
+ new(attributes)
24
+ end
25
+
26
+ type { SBF::Client::ShaveSchedule::ShaveScheduleAssignment::Type::SHAVEE }
27
+ shave_time { '12:00:00' }
28
+
29
+ after :build do |_shave_schedule_assignment, evaluator|
30
+ raise 'participant is required' if unpopulated?(evaluator, :participant)
31
+ end
32
+ end
33
+ end
@@ -0,0 +1,12 @@
1
+ FactoryBot.define do
2
+ factory :team_photos, class: SBF::Client::Team::Photos do
3
+ skip_create
4
+
5
+ initialize_with do
6
+ new(attributes)
7
+ end
8
+
9
+ avatar { 'avatar.jpg' }
10
+ default { 'default.jpg' }
11
+ end
12
+ end
@@ -0,0 +1,12 @@
1
+ FactoryBot.define do
2
+ factory :team_rankings_ranking, class: SBF::Client::Team::Rankings::Ranking do
3
+ skip_create
4
+
5
+ initialize_with do
6
+ new(attributes)
7
+ end
8
+
9
+ rank { 5 }
10
+ total { 10 }
11
+ end
12
+ end