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.
- checksums.yaml +4 -4
- data/lib/stbaldricks/endpoints/lib/entity.rb +1 -1
- data/lib/stbaldricks/entities/contact_group.rb +0 -1
- data/lib/stbaldricks/entities/lib/base.rb +6 -0
- data/lib/stbaldricks/entities/response.rb +2 -2
- data/lib/stbaldricks/patches/boolean.rb +2 -0
- data/lib/stbaldricks/patches/float.rb +2 -0
- data/lib/stbaldricks/patches/integer.rb +2 -0
- data/lib/stbaldricks/patches/nil.rb +2 -0
- data/lib/stbaldricks/patches/string.rb +2 -0
- data/lib/stbaldricks/version.rb +1 -1
- data/lib/stbaldricks_factories.rb +5 -0
- data/spec/factories/address.rb +14 -0
- data/spec/factories/campaign/totals.rb +9 -0
- data/spec/factories/campaign.rb +9 -0
- data/spec/factories/challenge.rb +19 -0
- data/spec/factories/challenger.rb +27 -0
- data/spec/factories/collection.rb +17 -0
- data/spec/factories/contact.rb +18 -0
- data/spec/factories/contact_group.rb +18 -0
- data/spec/factories/diagnosis.rb +12 -0
- data/spec/factories/disease.rb +11 -0
- data/spec/factories/donation/participant.rb +27 -0
- data/spec/factories/donation.rb +68 -0
- data/spec/factories/donor.rb +13 -0
- data/spec/factories/email_address.rb +11 -0
- data/spec/factories/error.rb +9 -0
- data/spec/factories/event/coach_tracking/coaching_interactions.rb +12 -0
- data/spec/factories/event/coach_tracking/plaque.rb +12 -0
- data/spec/factories/event/coach_tracking/proceeds.rb +12 -0
- data/spec/factories/event/coach_tracking.rb +18 -0
- data/spec/factories/event/contacts/contact.rb +17 -0
- data/spec/factories/event/contacts/name_pieces.rb +12 -0
- data/spec/factories/event/contacts.rb +16 -0
- data/spec/factories/event/photos.rb +12 -0
- data/spec/factories/event/totals.rb +15 -0
- data/spec/factories/event/venue/location.rb +18 -0
- data/spec/factories/event/venue/social.rb +16 -0
- data/spec/factories/event/venue.rb +16 -0
- data/spec/factories/event.rb +43 -0
- data/spec/factories/event_application.rb +34 -0
- data/spec/factories/event_supporter.rb +19 -0
- data/spec/factories/fund.rb +18 -0
- data/spec/factories/fundraiser/photos.rb +12 -0
- data/spec/factories/fundraiser/policies.rb +11 -0
- data/spec/factories/fundraiser/totals.rb +11 -0
- data/spec/factories/fundraiser.rb +24 -0
- data/spec/factories/fundraising_page.rb +29 -0
- data/spec/factories/grant.rb +22 -0
- data/spec/factories/grant_institution.rb +17 -0
- data/spec/factories/institution.rb +18 -0
- data/spec/factories/kid/custom_institution.rb +12 -0
- data/spec/factories/kid.rb +70 -0
- data/spec/factories/kid_honor.rb +16 -0
- data/spec/factories/kid_institution.rb +17 -0
- data/spec/factories/lib/helpers.rb +7 -0
- data/spec/factories/location.rb +17 -0
- data/spec/factories/memorial/photos.rb +14 -0
- data/spec/factories/memorial/totals.rb +11 -0
- data/spec/factories/memorial/tribute.rb +19 -0
- data/spec/factories/memorial.rb +22 -0
- data/spec/factories/message.rb +31 -0
- data/spec/factories/name_pieces.rb +24 -0
- data/spec/factories/newsletter_recipient.rb +13 -0
- data/spec/factories/organization/addresses.rb +16 -0
- data/spec/factories/organization/email_addresses.rb +14 -0
- data/spec/factories/organization/phone_numbers.rb +14 -0
- data/spec/factories/organization.rb +34 -0
- data/spec/factories/page.rb +5 -0
- data/spec/factories/participant/photos.rb +14 -0
- data/spec/factories/participant/policies.rb +12 -0
- data/spec/factories/participant/rankings/ranking.rb +12 -0
- data/spec/factories/participant/rankings.rb +16 -0
- data/spec/factories/participant/roles/role.rb +150 -0
- data/spec/factories/participant/roles.rb +35 -0
- data/spec/factories/participant/totals.rb +11 -0
- data/spec/factories/participant.rb +89 -0
- data/spec/factories/payment.rb +13 -0
- data/spec/factories/permissions.rb +12 -0
- data/spec/factories/person/addresses.rb +16 -0
- data/spec/factories/person/email_addresses.rb +14 -0
- data/spec/factories/person/phone_numbers.rb +14 -0
- data/spec/factories/person/policies.rb +13 -0
- data/spec/factories/person.rb +22 -0
- data/spec/factories/phone.rb +11 -0
- data/spec/factories/photo.rb +11 -0
- data/spec/factories/photos.rb +9 -0
- data/spec/factories/recurring_gift.rb +22 -0
- data/spec/factories/researcher.rb +15 -0
- data/spec/factories/response.rb +38 -0
- data/spec/factories/search_event.rb +19 -0
- data/spec/factories/search_fundraiser.rb +15 -0
- data/spec/factories/search_kid.rb +13 -0
- data/spec/factories/search_participant.rb +15 -0
- data/spec/factories/search_team.rb +13 -0
- data/spec/factories/shave_schedule/time_selection_permissions.rb +12 -0
- data/spec/factories/shave_schedule.rb +33 -0
- data/spec/factories/team/photos.rb +12 -0
- data/spec/factories/team/rankings/ranking.rb +12 -0
- data/spec/factories/team/rankings.rb +15 -0
- data/spec/factories/team/totals.rb +14 -0
- data/spec/factories/team.rb +43 -0
- data/spec/factories/third_party_media.rb +12 -0
- data/spec/factories/treatment_status.rb +10 -0
- data/spec/factories/user.rb +14 -0
- data/spec/factories/venue.rb +15 -0
- metadata +405 -5
@@ -0,0 +1,34 @@
|
|
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
|
@@ -0,0 +1,19 @@
|
|
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 = create(:event) if unpopulated?(evaluator, :event)
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
@@ -0,0 +1,18 @@
|
|
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
|
@@ -0,0 +1,24 @@
|
|
1
|
+
require_relative 'lib/helpers'
|
2
|
+
|
3
|
+
FactoryBot.define do
|
4
|
+
factory :fundraiser, class: SBF::Client::FullFundraiser 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 { 'active' }
|
12
|
+
fundraising_goal { 100 }
|
13
|
+
title { "#{Faker::University.greek_organization} #{random}" }
|
14
|
+
start_date { Date.today.to_s }
|
15
|
+
|
16
|
+
after :build do |fundraiser, evaluator|
|
17
|
+
fundraiser.event = SBF::Client::Fundraiser::PartialEvent.new(year: Time.now.year) if unpopulated?(evaluator, :event)
|
18
|
+
fundraiser.owner = build(:person) if unpopulated?(evaluator, :owner)
|
19
|
+
fundraiser.policies = build(:fundraiser_policies) if unpopulated?(evaluator, :policies)
|
20
|
+
fundraiser.venue = build(:venue) if unpopulated?(evaluator, :venue)
|
21
|
+
fundraiser.owner = create(:full_person) if unpopulated?(evaluator, :owner)
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
@@ -0,0 +1,29 @@
|
|
1
|
+
require_relative 'lib/helpers'
|
2
|
+
|
3
|
+
FactoryBot.define do
|
4
|
+
factory :fundraising_page, class: SBF::Client::FundraisingPage do
|
5
|
+
skip_create
|
6
|
+
|
7
|
+
initialize_with do
|
8
|
+
new(attributes)
|
9
|
+
end
|
10
|
+
|
11
|
+
after :build do |fundraising_page, evaluator|
|
12
|
+
fundraising_page.custom_url_segment = random(15) if unpopulated?(evaluator, :custom_url_segment)
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
16
|
+
|
17
|
+
FactoryBot.define do
|
18
|
+
factory :web_page, class: SBF::Client::WebPage do
|
19
|
+
skip_create
|
20
|
+
|
21
|
+
initialize_with do
|
22
|
+
new(attributes)
|
23
|
+
end
|
24
|
+
|
25
|
+
after :build do |web_page, evaluator|
|
26
|
+
web_page.custom_url_segment = random(15) if unpopulated?(evaluator, :custom_url_segment)
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
@@ -0,0 +1,22 @@
|
|
1
|
+
require_relative 'lib/helpers'
|
2
|
+
|
3
|
+
FactoryBot.define do
|
4
|
+
factory :grant, class: SBF::Client::FullGrant 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
|
+
sequence(:name) { |n| "Display Name #{n}" }
|
12
|
+
funding_begin_date { Time.now.to_s }
|
13
|
+
funding_end_date { Time.now.to_s }
|
14
|
+
funding_type { SBF::Client::Grant::PartialFundingType.new(id: 1) }
|
15
|
+
web_message { 'This grant supports research staff who' }
|
16
|
+
|
17
|
+
after :build do |grant, evaluator|
|
18
|
+
grant.researcher = build(:researcher) if unpopulated?(evaluator, :researcher)
|
19
|
+
grant.institution = build(:grant_institution) if unpopulated?(evaluator, :institution)
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
require_relative 'lib/helpers'
|
2
|
+
|
3
|
+
FactoryBot.define do
|
4
|
+
factory :grant_institution, class: SBF::Client::Grant::FullInstitution 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 { 'El Paso Children\'s Hospital' }
|
12
|
+
|
13
|
+
after :build do |grant_institution, evaluator|
|
14
|
+
grant_institution.send(:address=, build(:address)) if unpopulated?(evaluator, :address)
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
@@ -0,0 +1,18 @@
|
|
1
|
+
require_relative 'lib/helpers'
|
2
|
+
|
3
|
+
FactoryBot.define do
|
4
|
+
# This is system institutions object
|
5
|
+
factory :institution, class: SBF::Client::FullInstitution do
|
6
|
+
to_create { |it| raise "Failed to create #{it.class}: #{it.errors.details}" unless it.save }
|
7
|
+
|
8
|
+
initialize_with do
|
9
|
+
new(attributes)
|
10
|
+
end
|
11
|
+
|
12
|
+
name { "Institution #{random}" }
|
13
|
+
|
14
|
+
after :build do |institution, evaluator|
|
15
|
+
institution.address = build(:address, type: SBF::Client::Address::Type::BUSINESS) if unpopulated?(evaluator, :address)
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
@@ -0,0 +1,12 @@
|
|
1
|
+
FactoryBot.define do
|
2
|
+
# This is the custom institition specific to the kid
|
3
|
+
factory :kid_custom_institution, class: SBF::Client::Kid::CustomInstitution do
|
4
|
+
skip_create
|
5
|
+
|
6
|
+
initialize_with do
|
7
|
+
new(attributes)
|
8
|
+
end
|
9
|
+
|
10
|
+
name { "Custom #{Faker::Company.name}" }
|
11
|
+
end
|
12
|
+
end
|
@@ -0,0 +1,70 @@
|
|
1
|
+
require_relative 'lib/helpers'
|
2
|
+
|
3
|
+
FactoryBot.define do
|
4
|
+
factory :kid, class: SBF::Client::FullKid 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
|
+
birthday { Faker::Date.birthday(5, 25).to_s }
|
12
|
+
|
13
|
+
web_message { 'Thank you for supporting me and' }
|
14
|
+
status { 'active' }
|
15
|
+
gender { 'female' }
|
16
|
+
|
17
|
+
after :build do |kid, evaluator|
|
18
|
+
kid.name_pieces = build(:name_pieces) if unpopulated?(evaluator, :name_pieces)
|
19
|
+
kid.address = build(:address) if unpopulated?(evaluator, :address)
|
20
|
+
kid.diagnosis = build(:diagnosis) if unpopulated?(evaluator, :diagnosis)
|
21
|
+
kid.treatment_status = build(:treatment_status) if unpopulated?(evaluator, :treatment_status)
|
22
|
+
kid.web_page = build(:web_page) if unpopulated?(evaluator, :web_page)
|
23
|
+
kid.photos = build(:photos) if unpopulated?(evaluator, :photos)
|
24
|
+
kid.relationships = [build(:kid_submitter)] if unpopulated?(evaluator, :relationships)
|
25
|
+
kid.guardian = build(:guardian) if unpopulated?(evaluator, :guardian)
|
26
|
+
kid.custom_institutions = [] if unpopulated?(evaluator, :custom_institutions)
|
27
|
+
end
|
28
|
+
end
|
29
|
+
|
30
|
+
factory :kid_relationship, class: SBF::Client::Kid::Relationship do
|
31
|
+
skip_create
|
32
|
+
|
33
|
+
initialize_with do
|
34
|
+
new(attributes)
|
35
|
+
end
|
36
|
+
|
37
|
+
type { SBF::Client::Kid::Relationship::Type::MOTHER }
|
38
|
+
guardian_type { SBF::Client::Kid::Relationship::GuardianType::OTHER }
|
39
|
+
|
40
|
+
after :build do |relationship, evaluator|
|
41
|
+
relationship.person = create(:person) if unpopulated?(evaluator, :person)
|
42
|
+
end
|
43
|
+
end
|
44
|
+
|
45
|
+
factory :kid_submitter, parent: :kid_relationship do
|
46
|
+
is_submitter { true }
|
47
|
+
|
48
|
+
after :build do |relationship, evaluator|
|
49
|
+
relationship.permissions = {is_editor: true} if unpopulated?(evaluator, :permissions)
|
50
|
+
end
|
51
|
+
end
|
52
|
+
|
53
|
+
factory :guardian, class: SBF::Client::Guardian do
|
54
|
+
relationship { SBF::Client::Guardian::RelationshipType::MOTHER }
|
55
|
+
|
56
|
+
after :build do |kid, evaluator|
|
57
|
+
kid.name_pieces = build(:name_pieces) if unpopulated?(evaluator, :name_pieces)
|
58
|
+
kid.email_address = build(:email_address) if unpopulated?(evaluator, :email_address)
|
59
|
+
end
|
60
|
+
end
|
61
|
+
|
62
|
+
factory :kid_url, class: SBF::Client::KidURL do
|
63
|
+
skip_create
|
64
|
+
initialize_with do
|
65
|
+
new(attributes)
|
66
|
+
end
|
67
|
+
|
68
|
+
url { Faker::Internet.url }
|
69
|
+
end
|
70
|
+
end
|
@@ -0,0 +1,16 @@
|
|
1
|
+
require_relative 'lib/helpers'
|
2
|
+
|
3
|
+
FactoryBot.define do
|
4
|
+
factory :kid_honor, class: SBF::Client::KidHonor 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 |kid_honor, evaluator|
|
12
|
+
kid_honor.kid = create(:kid) if unpopulated?(evaluator, :kid)
|
13
|
+
kid_honor.honorer = create(:fundraiser) if unpopulated?(evaluator, :honorer)
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
require_relative 'lib/helpers'
|
2
|
+
|
3
|
+
FactoryBot.define do
|
4
|
+
# This is the relationship object between the kid and system institutions
|
5
|
+
factory :kid_institution, class: SBF::Client::KidInstitution do
|
6
|
+
to_create { |it| raise "Failed to create #{it.class}: #{it.errors.details}" unless it.save(kid: {}, institution: {}) }
|
7
|
+
|
8
|
+
initialize_with do
|
9
|
+
new(attributes)
|
10
|
+
end
|
11
|
+
|
12
|
+
after :build do |kid_institution, evaluator|
|
13
|
+
kid_institution.kid = build(:kid) if unpopulated?(evaluator, :kid)
|
14
|
+
kid_institution.institution = build(:institution) if unpopulated?(evaluator, :institution)
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
require_relative 'lib/helpers'
|
2
|
+
|
3
|
+
FactoryBot.define do
|
4
|
+
factory :location, class: SBF::Client::Location do
|
5
|
+
skip_create
|
6
|
+
|
7
|
+
initialize_with do
|
8
|
+
new(attributes)
|
9
|
+
end
|
10
|
+
|
11
|
+
sequence(:name) { |n| "Location #{n}" }
|
12
|
+
|
13
|
+
after :build do |location, evaluator|
|
14
|
+
location.address = build(:address) if unpopulated?(evaluator, :address)
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
@@ -0,0 +1,14 @@
|
|
1
|
+
FactoryBot.define do
|
2
|
+
factory :memorial_photos, class: SBF::Client::Memorial::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
|
+
cover { 'custom_cover.jpg' }
|
12
|
+
cover_original { 'original_cover.jpg' }
|
13
|
+
end
|
14
|
+
end
|
@@ -0,0 +1,19 @@
|
|
1
|
+
require 'faker'
|
2
|
+
|
3
|
+
FactoryBot.define do
|
4
|
+
factory :memorial_tribute, class: SBF::Client::Memorial::Tribute do
|
5
|
+
skip_create
|
6
|
+
|
7
|
+
initialize_with do
|
8
|
+
new(attributes)
|
9
|
+
end
|
10
|
+
|
11
|
+
# birthday { Faker::Date.between(DateTime.now - 16, DateTime.now - 4).to_s }
|
12
|
+
# date_of_passing { Faker::Date.between(birthday, DateTime.now).to_s }
|
13
|
+
# name { "#{Faker::Name.first_name} #{Faker::Name.last_name}" }
|
14
|
+
|
15
|
+
birthday { Time.now.to_s }
|
16
|
+
date_of_passing { Time.now.to_s }
|
17
|
+
sequence(:name) { |n| "Name #{n}" }
|
18
|
+
end
|
19
|
+
end
|
@@ -0,0 +1,22 @@
|
|
1
|
+
require_relative 'lib/helpers'
|
2
|
+
|
3
|
+
FactoryBot.define do
|
4
|
+
factory :memorial, class: SBF::Client::FullMemorial 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
|
+
website_message { 'Memorial ipsum dolor sit amet.' }
|
12
|
+
|
13
|
+
after :build do |memorial, evaluator|
|
14
|
+
memorial.photos = build(:memorial_photos) if unpopulated?(evaluator, :photos)
|
15
|
+
memorial.tribute = build(:memorial_tribute) if unpopulated?(evaluator, :tribute)
|
16
|
+
memorial.third_party_media = build(:third_party_media) if unpopulated?(evaluator, :third_party_media)
|
17
|
+
memorial.send(:totals=, build(:memorial_totals)) if unpopulated?(evaluator, :totals)
|
18
|
+
memorial.address = build(:address) if unpopulated?(evaluator, :address)
|
19
|
+
memorial.tribute = build(:tribute) if unpopulated?(evaluator, :tribute)
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
@@ -0,0 +1,31 @@
|
|
1
|
+
require_relative 'lib/helpers'
|
2
|
+
|
3
|
+
FactoryBot.define do
|
4
|
+
factory :message, class: SBF::Client::Message 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
|
+
type { SBF::Client::Message::Type::MEMBERS_COMMUNICATION }
|
12
|
+
status { SBF::Client::Message::Status::SENT }
|
13
|
+
subject { Faker::Lorem.sentence }
|
14
|
+
body { Faker::Lorem.paragraph }
|
15
|
+
|
16
|
+
after :build do |message, evaluator|
|
17
|
+
message.to = [build(:message_recipient)] if unpopulated?(evaluator, :to)
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
21
|
+
factory :message_recipient, class: SBF::Client::Message::Recipient do
|
22
|
+
skip_create
|
23
|
+
|
24
|
+
initialize_with do
|
25
|
+
new(attributes)
|
26
|
+
end
|
27
|
+
|
28
|
+
status { SBF::Client::Message::Recipient::Status::UNREAD }
|
29
|
+
email { Faker::Internet.email }
|
30
|
+
end
|
31
|
+
end
|
@@ -0,0 +1,24 @@
|
|
1
|
+
FactoryBot.define do
|
2
|
+
factory :name_pieces, class: SBF::Client::NamePieces do
|
3
|
+
skip_create
|
4
|
+
|
5
|
+
initialize_with do
|
6
|
+
new(attributes)
|
7
|
+
end
|
8
|
+
|
9
|
+
first_name { Faker::Name.first_name }
|
10
|
+
last_name { Faker::Name.last_name }
|
11
|
+
middle_initial { Faker::Name.middle_name.slice(0, 1) }
|
12
|
+
end
|
13
|
+
|
14
|
+
factory :event_contact_name_pieces, class: SBF::Client::Event::Contacts::NamePieces do
|
15
|
+
skip_create
|
16
|
+
|
17
|
+
initialize_with do
|
18
|
+
new(attributes)
|
19
|
+
end
|
20
|
+
|
21
|
+
first_name { Faker::Name.first_name }
|
22
|
+
last_name { Faker::Name.last_name }
|
23
|
+
end
|
24
|
+
end
|
@@ -0,0 +1,13 @@
|
|
1
|
+
FactoryBot.define do
|
2
|
+
factory :newsletter_recipient, class: SBF::Client::NewsletterRecipient do
|
3
|
+
skip_create
|
4
|
+
|
5
|
+
initialize_with do
|
6
|
+
new(attributes)
|
7
|
+
end
|
8
|
+
|
9
|
+
email_address { Faker::Internet.email }
|
10
|
+
first_name { Faker::Name.first_name }
|
11
|
+
last_name { Faker::Name.last_name }
|
12
|
+
end
|
13
|
+
end
|
@@ -0,0 +1,16 @@
|
|
1
|
+
require_relative '../lib/helpers'
|
2
|
+
|
3
|
+
FactoryBot.define do
|
4
|
+
factory :organization_addresses, class: SBF::Client::Organization::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 :organization_email_addresses, class: SBF::Client::Organization::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 :organization_phone_numbers, class: SBF::Client::Organization::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,34 @@
|
|
1
|
+
require_relative 'lib/helpers'
|
2
|
+
|
3
|
+
FactoryBot.define do
|
4
|
+
factory :organization, class: SBF::Client::FullOrganization 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 { 'active' }
|
12
|
+
name { Faker::Vehicle.manufacture }
|
13
|
+
type { SBF::Client::Person::Type::BUSINESS }
|
14
|
+
|
15
|
+
after :build do |organization, evaluator|
|
16
|
+
organization.email_addresses = build(:organization_email_addresses) if unpopulated?(evaluator, :email_addresses)
|
17
|
+
organization.phone_numbers = build(:organization_phone_numbers) if unpopulated?(evaluator, :phone_numbers)
|
18
|
+
organization.contact = build(:organization_contact) if unpopulated?(evaluator, :contact)
|
19
|
+
organization.addresses = build(:organization_addresses) if unpopulated?(evaluator, :addresses)
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
23
|
+
factory :organization_contact, class: SBF::Client::FullOrganization::ContactName do
|
24
|
+
skip_create
|
25
|
+
|
26
|
+
initialize_with do
|
27
|
+
new(attributes)
|
28
|
+
end
|
29
|
+
|
30
|
+
after :build do |contact, evaluator|
|
31
|
+
contact.name_pieces = build(:name_pieces) if unpopulated?(evaluator, :name_pieces)
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
@@ -0,0 +1,14 @@
|
|
1
|
+
FactoryBot.define do
|
2
|
+
factory :participant_photos, class: SBF::Client::Participant::Photos do
|
3
|
+
skip_create
|
4
|
+
|
5
|
+
initialize_with do
|
6
|
+
new(attributes)
|
7
|
+
end
|
8
|
+
|
9
|
+
add_attribute(:before) { 'before.jpg' }
|
10
|
+
add_attribute(:after) { 'after.jpg' }
|
11
|
+
avatar { 'avatar.jpg' }
|
12
|
+
default { 'default.jpg' }
|
13
|
+
end
|
14
|
+
end
|
@@ -0,0 +1,16 @@
|
|
1
|
+
require_relative '../lib/helpers'
|
2
|
+
|
3
|
+
FactoryBot.define do
|
4
|
+
factory :participant_rankings, class: SBF::Client::Participant::Rankings do
|
5
|
+
skip_create
|
6
|
+
|
7
|
+
initialize_with do
|
8
|
+
new(attributes)
|
9
|
+
end
|
10
|
+
|
11
|
+
after :build do |rankings, evaluator|
|
12
|
+
rankings.send(:team=, build(:participant_rankings_ranking)) if unpopulated?(evaluator, :team)
|
13
|
+
rankings.send(:event=, build(:participant_rankings_ranking)) if unpopulated?(evaluator, :event)
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|