stbaldricks 12.14.0 → 12.15.0.alpha.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (175) hide show
  1. checksums.yaml +4 -4
  2. data/lib/stbaldricks/configuration.rb +2 -2
  3. data/lib/stbaldricks/default_logger.rb +2 -2
  4. data/lib/stbaldricks/endpoints/blog_post.rb +8 -8
  5. data/lib/stbaldricks/endpoints/communicate.rb +1 -1
  6. data/lib/stbaldricks/endpoints/config.rb +1 -1
  7. data/lib/stbaldricks/endpoints/deduplicator_match.rb +2 -2
  8. data/lib/stbaldricks/endpoints/kid.rb +1 -1
  9. data/lib/stbaldricks/endpoints/lib/entity.rb +13 -11
  10. data/lib/stbaldricks/endpoints/newsletter_recipient.rb +11 -5
  11. data/lib/stbaldricks/endpoints/participant.rb +3 -3
  12. data/lib/stbaldricks/endpoints/photo.rb +5 -4
  13. data/lib/stbaldricks/endpoints/search.rb +2 -2
  14. data/lib/stbaldricks/endpoints/user.rb +1 -1
  15. data/lib/stbaldricks/entities/batch.rb +3 -5
  16. data/lib/stbaldricks/entities/blog_post.rb +1 -7
  17. data/lib/stbaldricks/entities/campaign.rb +6 -13
  18. data/lib/stbaldricks/entities/challenge.rb +4 -6
  19. data/lib/stbaldricks/entities/challenger.rb +4 -6
  20. data/lib/stbaldricks/entities/concerns/entity_response_concern.rb +1 -1
  21. data/lib/stbaldricks/entities/config.rb +3 -8
  22. data/lib/stbaldricks/entities/contact.rb +4 -7
  23. data/lib/stbaldricks/entities/contact_group.rb +2 -2
  24. data/lib/stbaldricks/entities/deduplicator_history.rb +1 -6
  25. data/lib/stbaldricks/entities/deduplicator_match.rb +4 -7
  26. data/lib/stbaldricks/entities/disease.rb +2 -5
  27. data/lib/stbaldricks/entities/document_library.rb +3 -8
  28. data/lib/stbaldricks/entities/document_library_category.rb +1 -4
  29. data/lib/stbaldricks/entities/donation.rb +12 -18
  30. data/lib/stbaldricks/entities/donor.rb +1 -5
  31. data/lib/stbaldricks/entities/event.rb +33 -44
  32. data/lib/stbaldricks/entities/event_application.rb +6 -10
  33. data/lib/stbaldricks/entities/event_donation_summary.rb +2 -5
  34. data/lib/stbaldricks/entities/event_participant_summary.rb +1 -3
  35. data/lib/stbaldricks/entities/event_supporter.rb +3 -3
  36. data/lib/stbaldricks/entities/fund.rb +6 -23
  37. data/lib/stbaldricks/entities/fundraiser.rb +16 -29
  38. data/lib/stbaldricks/entities/grant.rb +12 -25
  39. data/lib/stbaldricks/entities/institution.rb +3 -4
  40. data/lib/stbaldricks/entities/international_partner.rb +4 -16
  41. data/lib/stbaldricks/entities/kid.rb +11 -28
  42. data/lib/stbaldricks/entities/kid_honor.rb +1 -0
  43. data/lib/stbaldricks/entities/kid_institution.rb +2 -2
  44. data/lib/stbaldricks/entities/lib/address.rb +3 -6
  45. data/lib/stbaldricks/entities/lib/alternate_shipping_address.rb +1 -3
  46. data/lib/stbaldricks/entities/lib/base.rb +47 -39
  47. data/lib/stbaldricks/entities/lib/collection.rb +2 -2
  48. data/lib/stbaldricks/entities/lib/email_address.rb +1 -2
  49. data/lib/stbaldricks/entities/lib/fundraising_page.rb +1 -2
  50. data/lib/stbaldricks/entities/lib/location.rb +1 -0
  51. data/lib/stbaldricks/entities/lib/milestone.rb +1 -3
  52. data/lib/stbaldricks/entities/lib/name.rb +2 -2
  53. data/lib/stbaldricks/entities/lib/not_implemented_object.rb +1 -1
  54. data/lib/stbaldricks/entities/lib/permissions.rb +2 -4
  55. data/lib/stbaldricks/entities/lib/phone.rb +2 -3
  56. data/lib/stbaldricks/entities/lib/third_party_media.rb +1 -5
  57. data/lib/stbaldricks/entities/lib/top_level.rb +1 -1
  58. data/lib/stbaldricks/entities/matching_gift_company.rb +16 -39
  59. data/lib/stbaldricks/entities/memorial.rb +9 -14
  60. data/lib/stbaldricks/entities/message.rb +4 -15
  61. data/lib/stbaldricks/entities/organization.rb +11 -17
  62. data/lib/stbaldricks/entities/page.rb +8 -17
  63. data/lib/stbaldricks/entities/participant.rb +18 -28
  64. data/lib/stbaldricks/entities/participant_donation_summary.rb +2 -4
  65. data/lib/stbaldricks/entities/person.rb +22 -31
  66. data/lib/stbaldricks/entities/person_donation_by_year_summary.rb +1 -2
  67. data/lib/stbaldricks/entities/photo.rb +5 -11
  68. data/lib/stbaldricks/entities/recurring_gift.rb +10 -18
  69. data/lib/stbaldricks/entities/response.rb +1 -0
  70. data/lib/stbaldricks/entities/search.rb +30 -168
  71. data/lib/stbaldricks/entities/section.rb +1 -4
  72. data/lib/stbaldricks/entities/shave_schedule.rb +4 -13
  73. data/lib/stbaldricks/entities/summary.rb +1 -7
  74. data/lib/stbaldricks/entities/team.rb +12 -16
  75. data/lib/stbaldricks/entities/team_donation_summary.rb +2 -4
  76. data/lib/stbaldricks/request.rb +2 -2
  77. data/lib/stbaldricks/version.rb +1 -1
  78. metadata +83 -277
  79. data/lib/stbaldricks_factories.rb +0 -5
  80. data/spec/factories/address.rb +0 -14
  81. data/spec/factories/campaign/totals.rb +0 -9
  82. data/spec/factories/campaign.rb +0 -9
  83. data/spec/factories/challenge.rb +0 -19
  84. data/spec/factories/challenger.rb +0 -33
  85. data/spec/factories/collection.rb +0 -17
  86. data/spec/factories/contact.rb +0 -18
  87. data/spec/factories/contact_group.rb +0 -18
  88. data/spec/factories/diagnosis.rb +0 -12
  89. data/spec/factories/disease.rb +0 -11
  90. data/spec/factories/donation/participant.rb +0 -27
  91. data/spec/factories/donation.rb +0 -68
  92. data/spec/factories/donor.rb +0 -13
  93. data/spec/factories/email_address.rb +0 -11
  94. data/spec/factories/error.rb +0 -9
  95. data/spec/factories/event/coach_tracking/coaching_interactions.rb +0 -12
  96. data/spec/factories/event/coach_tracking/plaque.rb +0 -12
  97. data/spec/factories/event/coach_tracking/proceeds.rb +0 -12
  98. data/spec/factories/event/coach_tracking.rb +0 -18
  99. data/spec/factories/event/contacts/contact.rb +0 -17
  100. data/spec/factories/event/contacts/name_pieces.rb +0 -12
  101. data/spec/factories/event/contacts.rb +0 -16
  102. data/spec/factories/event/photos.rb +0 -12
  103. data/spec/factories/event/totals.rb +0 -15
  104. data/spec/factories/event/venue/location.rb +0 -18
  105. data/spec/factories/event/venue/social.rb +0 -16
  106. data/spec/factories/event/venue.rb +0 -16
  107. data/spec/factories/event.rb +0 -66
  108. data/spec/factories/event_application.rb +0 -34
  109. data/spec/factories/event_supporter.rb +0 -19
  110. data/spec/factories/fund.rb +0 -18
  111. data/spec/factories/fundraiser/photos.rb +0 -12
  112. data/spec/factories/fundraiser/policies.rb +0 -11
  113. data/spec/factories/fundraiser/totals.rb +0 -11
  114. data/spec/factories/fundraiser.rb +0 -24
  115. data/spec/factories/fundraising_page.rb +0 -29
  116. data/spec/factories/grant.rb +0 -22
  117. data/spec/factories/grant_institution.rb +0 -17
  118. data/spec/factories/institution.rb +0 -18
  119. data/spec/factories/kid/custom_institution.rb +0 -12
  120. data/spec/factories/kid.rb +0 -58
  121. data/spec/factories/kid_honor.rb +0 -16
  122. data/spec/factories/kid_institution.rb +0 -23
  123. data/spec/factories/lib/faker_patch.rb +0 -27
  124. data/spec/factories/lib/helpers.rb +0 -7
  125. data/spec/factories/location.rb +0 -17
  126. data/spec/factories/memorial/photos.rb +0 -14
  127. data/spec/factories/memorial/totals.rb +0 -11
  128. data/spec/factories/memorial/tribute.rb +0 -19
  129. data/spec/factories/memorial.rb +0 -22
  130. data/spec/factories/message.rb +0 -31
  131. data/spec/factories/milestone.rb +0 -15
  132. data/spec/factories/name_pieces.rb +0 -24
  133. data/spec/factories/newsletter_recipient.rb +0 -13
  134. data/spec/factories/organization/addresses.rb +0 -16
  135. data/spec/factories/organization/email_addresses.rb +0 -14
  136. data/spec/factories/organization/phone_numbers.rb +0 -14
  137. data/spec/factories/organization.rb +0 -34
  138. data/spec/factories/page.rb +0 -5
  139. data/spec/factories/participant/photos.rb +0 -14
  140. data/spec/factories/participant/policies.rb +0 -12
  141. data/spec/factories/participant/rankings/ranking.rb +0 -12
  142. data/spec/factories/participant/rankings.rb +0 -16
  143. data/spec/factories/participant/roles/role.rb +0 -154
  144. data/spec/factories/participant/roles.rb +0 -37
  145. data/spec/factories/participant/totals.rb +0 -11
  146. data/spec/factories/participant.rb +0 -95
  147. data/spec/factories/payment.rb +0 -13
  148. data/spec/factories/permissions.rb +0 -12
  149. data/spec/factories/person/addresses.rb +0 -16
  150. data/spec/factories/person/email_addresses.rb +0 -14
  151. data/spec/factories/person/phone_numbers.rb +0 -14
  152. data/spec/factories/person/policies.rb +0 -13
  153. data/spec/factories/person.rb +0 -22
  154. data/spec/factories/phone.rb +0 -11
  155. data/spec/factories/photo.rb +0 -11
  156. data/spec/factories/photos.rb +0 -9
  157. data/spec/factories/recurring_gift.rb +0 -22
  158. data/spec/factories/researcher.rb +0 -15
  159. data/spec/factories/response.rb +0 -38
  160. data/spec/factories/search_event.rb +0 -19
  161. data/spec/factories/search_fundraiser.rb +0 -15
  162. data/spec/factories/search_kid.rb +0 -13
  163. data/spec/factories/search_participant.rb +0 -15
  164. data/spec/factories/search_team.rb +0 -13
  165. data/spec/factories/shave_schedule/time_selection_permissions.rb +0 -12
  166. data/spec/factories/shave_schedule.rb +0 -33
  167. data/spec/factories/team/photos.rb +0 -12
  168. data/spec/factories/team/rankings/ranking.rb +0 -12
  169. data/spec/factories/team/rankings.rb +0 -15
  170. data/spec/factories/team/totals.rb +0 -14
  171. data/spec/factories/team.rb +0 -43
  172. data/spec/factories/third_party_media.rb +0 -12
  173. data/spec/factories/treatment_status.rb +0 -10
  174. data/spec/factories/user.rb +0 -14
  175. data/spec/factories/venue.rb +0 -15
@@ -1,9 +0,0 @@
1
- FactoryBot.define do
2
- factory :totals, class: SBF::Client::Campaign::Totals do
3
- skip_create
4
-
5
- initialize_with do
6
- new(attributes)
7
- end
8
- end
9
- end
@@ -1,9 +0,0 @@
1
- FactoryBot.define do
2
- factory :campaign, class: SBF::Client::FullCampaign do
3
- skip_create
4
-
5
- initialize_with do
6
- new(attributes)
7
- end
8
- end
9
- end
@@ -1,19 +0,0 @@
1
- require_relative 'lib/helpers'
2
-
3
- FactoryBot.define do
4
- factory :challenge, class: SBF::Client::Challenge 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
- status { SBF::Client::Challenge::Status::PENDING }
12
- end_date { [Date.today + 30, Date.new(Date.today.year, 12, 31)].min }
13
-
14
- after :build do |challenge, evaluator|
15
- challenge.challenger = build(:challenger) if unpopulated?(evaluator, :challenger)
16
- challenge.challengee = build(:challengee) if unpopulated?(evaluator, :challengee)
17
- end
18
- end
19
- end
@@ -1,33 +0,0 @@
1
- require_relative 'lib/helpers'
2
-
3
- FactoryBot.define do
4
- factory :_base_challenger, class: SBF::Client::Challenger do
5
- to_create do |it|
6
- raise "Failed to create #{it.class}: #{it.errors.details}" unless it.save
7
- end
8
-
9
- initialize_with do
10
- new(attributes)
11
- end
12
-
13
- after :build do |challenger, evaluator|
14
- # TODO: Unable to move to to_create block, to_create block.
15
- # Entity returns a DataNotProvidedError when referenced in
16
- # the to_create block. Needs to be fixed when the data model
17
- # is fixed.
18
- if unpopulated?(evaluator, :entity)
19
- event = build(:event)
20
- participant = create(:shavee, event: event)
21
- challenger.entity = participant.to_partial
22
- end
23
- end
24
- end
25
-
26
- factory :challenger, class: SBF::Client::Challenger, parent: :_base_challenger do
27
- is_accepted { true }
28
- end
29
-
30
- factory :challengee, class: SBF::Client::Challenger, parent: :_base_challenger do
31
- is_accepted { false }
32
- end
33
- end
@@ -1,17 +0,0 @@
1
- FactoryBot.define do
2
- factory :collection, class: SBF::Client::EntityCollection do
3
- skip_create
4
- end
5
-
6
- factory :collection_with_error, parent: :collection do
7
- after :build do |collection, evaluator|
8
- if evaluator.error
9
- collection.add_errors(evaluator.error)
10
- else
11
- error = SBF::Client::ErrorEntity.new(code: 5007, type: 'BadRequest', details: 'Invalid Request')
12
- collection.add_errors(error)
13
- end
14
- collection.errors_http_code = evaluator.http_code || 400
15
- end
16
- end
17
- end
@@ -1,18 +0,0 @@
1
- require_relative 'lib/helpers'
2
-
3
- FactoryBot.define do
4
- factory :contact, class: SBF::Client::CustomContact 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
- email { Faker::Internet.email }
12
- contact_groups { [] }
13
-
14
- after :build do |contact_group, evaluator|
15
- contact_group.owner = build(:person) if unpopulated?(evaluator, :owner)
16
- end
17
- end
18
- end
@@ -1,18 +0,0 @@
1
- require_relative 'lib/helpers'
2
-
3
- FactoryBot.define do
4
- factory :contact_group, class: SBF::Client::ContactGroup 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
- display_name { random }
12
- contacts { [] }
13
-
14
- after :build do |contact_group, evaluator|
15
- contact_group.owner = build(:person) if unpopulated?(evaluator, :owner)
16
- end
17
- end
18
- end
@@ -1,12 +0,0 @@
1
- FactoryBot.define do
2
- factory :diagnosis, class: SBF::Client::Diagnosis do
3
- skip_create
4
-
5
- initialize_with do
6
- new(attributes)
7
- end
8
-
9
- cancer_type { SBF::Client::Diagnosis::CancerType::EWING_SARCOMA }
10
- date { '2015-05-05' }
11
- end
12
- end
@@ -1,11 +0,0 @@
1
- FactoryBot.define do
2
- factory :disease, class: SBF::Client::Grant::Disease do
3
- to_create { |it| raise "Failed to create #{it.class}: #{it.errors.details}" unless it.save }
4
-
5
- initialize_with do
6
- new(attributes)
7
- end
8
-
9
- name { SecureRandom.hex }
10
- end
11
- end
@@ -1,27 +0,0 @@
1
- require_relative '../lib/helpers'
2
-
3
- FactoryBot.define do
4
- factory :full_donation_participant, class: SBF::Client::Donation::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
- sequence(:display_name) { |n| "Display Name #{n}" }
14
- model_type { 'person' }
15
-
16
- after :build do |participant, evaluator|
17
- participant.person = build(:person) if unpopulated?(evaluator, :person)
18
- participant.send(:totals=, build(:participant_totals)) if unpopulated?(evaluator, :totals)
19
- participant.send(:rankings=, build(:participant_rankings)) if unpopulated?(evaluator, :rankings)
20
- participant.roles = build(:participant_roles) if unpopulated?(evaluator, :roles)
21
- participant.send(:photos=, build(:participant_photos)) if unpopulated?(evaluator, :photos)
22
- participant.event = build(:event) if unpopulated?(evaluator, :event)
23
- participant.team = build(:team, event: participant.event) if unpopulated?(evaluator, :team)
24
- participant.fundraising_page = build(:fundraising_page) if unpopulated?(evaluator, :fundraising_page)
25
- end
26
- end
27
- end
@@ -1,68 +0,0 @@
1
- require_relative 'lib/helpers'
2
-
3
- FactoryBot.define do
4
- factory :_donation, class: SBF::Client::FullDonation 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
- status { SBF::Client::Donation::Status::ACTIVE }
12
- amount { rand(10..100) }
13
- display_name { Faker::Name.name }
14
- year { DateTime.now.year }
15
- fund { nil }
16
- memorial { nil }
17
- end
18
-
19
- factory :donation, class: SBF::Client::FullDonation, parent: :_donation do
20
- after :build do |donation, evaluator|
21
- donation.payment_details = build(:cc_payment) if unpopulated?(evaluator, :payment_details)
22
- donation.donor = build(:person) if unpopulated?(evaluator, :donor)
23
- end
24
- end
25
-
26
- factory :cc_payment, class: SBF::Client::Payment::CreditCardDetails do
27
- end
28
-
29
- factory :cash_donation, class: SBF::Client::FullDonation, parent: :_donation do
30
- status { SBF::Client::Donation::Status::PENDING }
31
- how_created { SBF::Client::Donation::HowCreated::SUBMIT_CASH }
32
-
33
- after :build do |donation, evaluator|
34
- donation.payment_details = build(:cash_payment) if unpopulated?(evaluator, :payment_details)
35
- donation.donor = build(:person, status: SBF::Client::Person::Status::PENDING) if unpopulated?(evaluator, :donor)
36
- donation.submitter = build(:person) if unpopulated?(evaluator, :submitter)
37
- end
38
- end
39
-
40
- factory :cash_payment, class: SBF::Client::Payment::CashDetails do
41
- end
42
-
43
- factory :nonce_payment, class: SBF::Client::Payment::NonceDetails do
44
- gateway { SBF::Client::Payment::Gateway::PAYMENTSPRING }
45
- nonce { fake_valid_nonce }
46
- device_data { random }
47
- end
48
- end
49
-
50
- require 'httparty'
51
- require 'uri'
52
- def fake_valid_nonce
53
- url = "#{ENV['PAYMENTSPRING_BASE_URL']}/tokens/jsonp"
54
- pub_key = ENV['PAYMENTSPRING_PUBLIC_KEY']
55
- data = {
56
- public_api_key: pub_key,
57
- card_number: '4111111111111111',
58
- card_exp_month: '1',
59
- card_exp_year: Date.today.year + 1,
60
- card_owner_name: 'John%20Doe'
61
- }
62
-
63
- uri = URI.parse("#{url}?#{data.to_query}")
64
- response = HTTParty.get(uri, headers: {'Accept' => 'application/json'})
65
- raise 'Error retrieving valid nonce' unless response.ok?
66
-
67
- response.parsed_response['id']
68
- end
@@ -1,13 +0,0 @@
1
- FactoryBot.define do
2
- factory :donor, class: SBF::Client::Donor do
3
- skip_create
4
-
5
- initialize_with do
6
- new(attributes)
7
- end
8
-
9
- sequence(:donor_name) { |n| "donor name #{n}" }
10
- amount { 100 }
11
- donation_created_at { DateTime.now.to_s }
12
- end
13
- end
@@ -1,11 +0,0 @@
1
- FactoryBot.define do
2
- factory :email_address, class: SBF::Client::EmailAddress do
3
- skip_create
4
-
5
- initialize_with do
6
- new(attributes)
7
- end
8
-
9
- email_address { Faker::Internet.safe_email(name: "test.#{random}") }
10
- end
11
- end
@@ -1,9 +0,0 @@
1
- FactoryBot.define do
2
- factory :error, class: SBF::Client::ErrorEntity do
3
- skip_create
4
-
5
- initialize_with do
6
- new(attributes)
7
- end
8
- end
9
- end
@@ -1,12 +0,0 @@
1
- FactoryBot.define do
2
- factory :event_coach_tracking_coaching_interactions, class: SBF::Client::Event::CoachTracking::CoachingInteractions do
3
- skip_create
4
-
5
- initialize_with do
6
- new(attributes)
7
- end
8
-
9
- introductory_conversation_date { Time.now.to_s }
10
- post_event_conversation_date { Time.now.to_s }
11
- end
12
- end
@@ -1,12 +0,0 @@
1
- FactoryBot.define do
2
- factory :event_coach_tracking_plaque, class: SBF::Client::Event::CoachTracking::Plaque do
3
- skip_create
4
-
5
- initialize_with do
6
- new(attributes)
7
- end
8
-
9
- sequence(:issued_to) { |n| "Issued To: #{n}" }
10
- sent_date { Time.now.to_s }
11
- end
12
- end
@@ -1,12 +0,0 @@
1
- FactoryBot.define do
2
- factory :event_coach_tracking_proceeds, class: SBF::Client::Event::CoachTracking::Proceeds do
3
- skip_create
4
-
5
- initialize_with do
6
- new(attributes)
7
- end
8
-
9
- received_date { Time.now.to_s }
10
- notification_email_sent_date { Time.now.to_s }
11
- end
12
- end
@@ -1,18 +0,0 @@
1
- FactoryBot.define do
2
- factory :event_coach_tracking, class: SBF::Client::Event::CoachTracking do
3
- skip_create
4
-
5
- initialize_with do
6
- new(attributes)
7
- end
8
-
9
- host_agreement_date { Time.now.to_s }
10
- activated_date { Time.now.to_s }
11
-
12
- after :build do |coach_tracking, _evaluator|
13
- coach_tracking.proceeds = build(:event_coach_tracking_proceeds)
14
- coach_tracking.coaching_interactions = build(:event_coach_tracking_coaching_interactions)
15
- coach_tracking.plaque = build(:event_coach_tracking_plaque)
16
- end
17
- end
18
- end
@@ -1,17 +0,0 @@
1
- require_relative '../../lib/helpers'
2
-
3
- FactoryBot.define do
4
- factory :event_contact, class: SBF::Client::Event::Contacts::Contact do
5
- skip_create
6
-
7
- initialize_with do
8
- new(attributes)
9
- end
10
-
11
- after :build do |contact, evaluator|
12
- contact.name_pieces = build(:event_contact_name_pieces) if unpopulated?(evaluator, :name_pieces)
13
- contact.phone = build(:phone) if unpopulated?(evaluator, :phone)
14
- contact.email_address = build(:email_address) if unpopulated?(evaluator, :email_address)
15
- end
16
- end
17
- end
@@ -1,12 +0,0 @@
1
- FactoryBot.define do
2
- factory :event_name_pieces, class: SBF::Client::Event::Contacts::NamePieces do
3
- skip_create
4
-
5
- initialize_with do
6
- new(attributes)
7
- end
8
-
9
- first_name { 'John' }
10
- last_name { 'Smith' }
11
- end
12
- end
@@ -1,16 +0,0 @@
1
- require_relative '../lib/helpers'
2
-
3
- FactoryBot.define do
4
- factory :event_contacts, class: SBF::Client::Event::Contacts do
5
- skip_create
6
-
7
- initialize_with do
8
- new(attributes)
9
- end
10
-
11
- after :build do |contacts, evaluator|
12
- contacts.primary = build(:event_contact) if unpopulated?(evaluator, :primary)
13
- contacts.secondary = build(:event_contact) if unpopulated?(evaluator, :secondary)
14
- end
15
- end
16
- end
@@ -1,12 +0,0 @@
1
- FactoryBot.define do
2
- factory :event_photos, class: SBF::Client::Event::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
@@ -1,15 +0,0 @@
1
- FactoryBot.define do
2
- factory :event_totals, class: SBF::Client::Event::Totals do
3
- skip_create
4
-
5
- initialize_with do
6
- new(attributes)
7
- end
8
-
9
- fundraisers { 1 }
10
- participants { 8 }
11
- shavees { 5 }
12
- teams { 2 }
13
- amount_raised { 100 }
14
- end
15
- end
@@ -1,18 +0,0 @@
1
- require_relative '../../lib/helpers'
2
-
3
- FactoryBot.define do
4
- factory :event_venue_location, class: SBF::Client::Event::Venue::Location do
5
- skip_create
6
-
7
- initialize_with do
8
- new(attributes)
9
- end
10
-
11
- type { SBF::Client::Event::Venue::Location::Type::OTHER }
12
- name { Faker::University.name }
13
-
14
- after :build do |location, evaluator|
15
- location.address = build(:address) if unpopulated?(evaluator, :address)
16
- end
17
- end
18
- end
@@ -1,16 +0,0 @@
1
- require_relative '../../lib/helpers'
2
-
3
- FactoryBot.define do
4
- factory :event_venue_social, class: SBF::Client::Event::Venue::Social do
5
- skip_create
6
-
7
- initialize_with do
8
- new(attributes)
9
- end
10
-
11
- after :build do |social, evaluator|
12
- social.facebook_url = "https://www.facebook.com/#{Faker::Internet.slug}" if unpopulated?(evaluator, :facebook_url)
13
- social.twitter_name = "@#{Faker::Twitter.screen_name.slice(0, 14)}" if unpopulated?(evaluator, :twitter_name)
14
- end
15
- end
16
- end
@@ -1,16 +0,0 @@
1
- require_relative '../lib/helpers'
2
-
3
- FactoryBot.define do
4
- factory :event_venue, class: SBF::Client::Event::Venue do
5
- skip_create
6
-
7
- initialize_with do
8
- new(attributes)
9
- end
10
-
11
- after :build do |venue, evaluator|
12
- venue.location = build(:event_venue_location) if unpopulated?(evaluator, :location)
13
- venue.social = build(:event_venue_social) if unpopulated?(evaluator, :social)
14
- end
15
- end
16
- end
@@ -1,66 +0,0 @@
1
- require_relative 'lib/helpers'
2
-
3
- FactoryBot.define do
4
- factory :event, class: SBF::Client::FullEvent 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
- event_title { "#{Faker::Team.name} #{random}" }
12
- year { Time.now.year }
13
- date { Time.now.to_s }
14
- fund_relationship_type { 'no_association' }
15
- status { 'active' }
16
- type { 'head_shaving' }
17
- sub_type { 'community' }
18
- how_created { 'admin_control_panel' }
19
- fundraising_goal { rand(20) * 5000 }
20
- is_private { false }
21
-
22
- after :build do |event, evaluator|
23
- event.venue = build(:event_venue) if unpopulated?(evaluator, :venue)
24
- event.contacts = build(:event_contacts) if unpopulated?(evaluator, :contacts)
25
- event.organizers = [build(:lead_organizer, person: build(:person))] if unpopulated?(evaluator, :organizers)
26
- end
27
- end
28
-
29
- factory :event_activity, class: SBF::Client::Event::Activity do
30
- skip_create
31
-
32
- initialize_with do
33
- new(attributes)
34
- end
35
-
36
- start_time { '12:00:00' }
37
- end_time { '14:00:00' }
38
- activity { random }
39
- sort_order { 1 }
40
- end
41
- factory :past_event, class: SBF::Client::FullEvent do
42
- to_create { |it| raise "Failed to create #{it.class}: #{it.errors.details}" unless it.create }
43
-
44
- initialize_with do
45
- new(attributes)
46
- end
47
-
48
- id { rand(1000) }
49
- event_title { "#{Faker::Team.name} #{random}" }
50
- year { Time.now.year - 5 }
51
- date { Time.now.to_s }
52
- fund_relationship_type { 'no_association' }
53
- status { 'active' }
54
- type { 'head_shaving' }
55
- sub_type { 'community' }
56
- how_created { 'admin_control_panel' }
57
- fundraising_goal { rand(20) * 5000 }
58
- is_private { false }
59
-
60
- after :build do |event, evaluator|
61
- event.venue = build(:event_venue) if unpopulated?(evaluator, :venue)
62
- event.contacts = build(:event_contacts) if unpopulated?(evaluator, :contacts)
63
- event.organizers = [build(:lead_organizer, person: build(:person))] if unpopulated?(evaluator, :organizers)
64
- end
65
- end
66
- end
@@ -1,34 +0,0 @@
1
- require_relative 'lib/helpers'
2
-
3
- FactoryBot.define do
4
- factory :event_application, class: SBF::Client::EventApplication 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
- requested_event_title { "Event Title #{random}" }
12
-
13
- after :build do |event_application, evaluator|
14
- event_application.requestor = build(:requestor) if unpopulated?(evaluator, :requestor)
15
- end
16
- end
17
-
18
- factory :requestor, class: SBF::Client::EventApplication::Requestor do
19
- skip_create
20
-
21
- initialize_with do
22
- new(attributes)
23
- end
24
-
25
- name { Faker::Name.name }
26
-
27
- after :build do |requestor, evaluator|
28
- requestor.name_pieces = build(:name_pieces) if unpopulated?(evaluator, :name_pieces)
29
- requestor.email_address = build(:email_address) if unpopulated?(evaluator, :email_address)
30
- requestor.phone = build(:phone) if unpopulated?(evaluator, :phone)
31
- requestor.address = build(:address) if unpopulated?(evaluator, :address)
32
- end
33
- end
34
- end
@@ -1,19 +0,0 @@
1
- require_relative 'lib/helpers'
2
-
3
- FactoryBot.define do
4
- factory :event_supporter, class: SBF::Client::FullEventSupporter 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
- name { "Supporter #{random}" }
12
- url { Faker::Internet.url }
13
- sort_order { 1 }
14
-
15
- after :build do |event_supporter, evaluator|
16
- event_supporter.event = build(:event) if unpopulated?(evaluator, :event)
17
- end
18
- end
19
- end
@@ -1,18 +0,0 @@
1
- require_relative 'lib/helpers'
2
-
3
- FactoryBot.define do
4
- factory :fund, class: SBF::Client::FullFund 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
- name { Faker::University.greek_organization }
12
- disabled { false }
13
-
14
- after :build do |fund, evaluator|
15
- fund.fundraising_page = build(:fundraising_page) if unpopulated?(evaluator, :fundraising_page)
16
- end
17
- end
18
- end
@@ -1,12 +0,0 @@
1
- FactoryBot.define do
2
- factory :fundraiser_photos, class: SBF::Client::Fundraiser::Photos do
3
- skip_create
4
-
5
- initialize_with do
6
- new(attributes)
7
- end
8
-
9
- avatar { 'foo.jpg' }
10
- default { 'foo.jpg' }
11
- end
12
- end
@@ -1,11 +0,0 @@
1
- FactoryBot.define do
2
- factory :fundraiser_policies, class: SBF::Client::Fundraiser::Policies do
3
- skip_create
4
-
5
- initialize_with do
6
- new(attributes)
7
- end
8
-
9
- is_waiver_policy_accepted { true }
10
- end
11
- end
@@ -1,11 +0,0 @@
1
- FactoryBot.define do
2
- factory :fundraiser_totals, class: SBF::Client::Fundraiser::Totals do
3
- skip_create
4
-
5
- initialize_with do
6
- new(attributes)
7
- end
8
-
9
- amount_raised { 100 }
10
- end
11
- end