stbaldricks 10.4.0.alpha.2 → 10.6.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/configuration.rb +4 -4
- data/lib/stbaldricks/endpoints/donation.rb +2 -2
- data/lib/stbaldricks/endpoints/lib/entity.rb +2 -2
- data/lib/stbaldricks/endpoints/photo.rb +1 -3
- data/lib/stbaldricks/entities/batch.rb +2 -2
- data/lib/stbaldricks/entities/challenge.rb +4 -4
- data/lib/stbaldricks/entities/challenger.rb +2 -2
- data/lib/stbaldricks/entities/challenger/model_type.rb +2 -0
- data/lib/stbaldricks/entities/concerns/entity_response_concern.rb +2 -4
- data/lib/stbaldricks/entities/config.rb +1 -1
- data/lib/stbaldricks/entities/contact.rb +1 -1
- data/lib/stbaldricks/entities/deduplicator_match.rb +5 -5
- data/lib/stbaldricks/entities/donation.rb +3 -3
- data/lib/stbaldricks/entities/donation/donor_type.rb +2 -0
- data/lib/stbaldricks/entities/donation/how_created.rb +2 -0
- data/lib/stbaldricks/entities/donation/payment_gateway.rb +2 -0
- data/lib/stbaldricks/entities/donation/payment_type.rb +2 -0
- data/lib/stbaldricks/entities/donation/promo_code.rb +19 -5
- data/lib/stbaldricks/entities/donation/recipient_type.rb +2 -0
- data/lib/stbaldricks/entities/donation/special_donation_type.rb +2 -0
- data/lib/stbaldricks/entities/donation/status.rb +2 -0
- data/lib/stbaldricks/entities/donation/submitter_type.rb +2 -0
- data/lib/stbaldricks/entities/event.rb +10 -14
- data/lib/stbaldricks/entities/event/fund_relationship_type.rb +2 -0
- data/lib/stbaldricks/entities/event/how_created.rb +2 -0
- data/lib/stbaldricks/entities/event/promo_code.rb +2 -0
- data/lib/stbaldricks/entities/event/status.rb +2 -0
- data/lib/stbaldricks/entities/event/sub_type.rb +2 -0
- data/lib/stbaldricks/entities/event/type.rb +2 -0
- data/lib/stbaldricks/entities/event_application/model_type.rb +2 -0
- data/lib/stbaldricks/entities/event_application/status.rb +2 -0
- data/lib/stbaldricks/entities/fund.rb +1 -2
- data/lib/stbaldricks/entities/fundraiser.rb +21 -25
- data/lib/stbaldricks/entities/international_partner.rb +2 -2
- data/lib/stbaldricks/entities/kid.rb +62 -62
- data/lib/stbaldricks/entities/kid_honor.rb +4 -4
- data/lib/stbaldricks/entities/lib/address.rb +2 -2
- data/lib/stbaldricks/entities/lib/alternate_shipping_address.rb +2 -2
- data/lib/stbaldricks/entities/lib/base.rb +24 -27
- data/lib/stbaldricks/entities/lib/cacheable.rb +1 -3
- data/lib/stbaldricks/entities/lib/collection.rb +2 -2
- data/lib/stbaldricks/entities/lib/email_address.rb +2 -2
- data/lib/stbaldricks/entities/lib/fundraising_page.rb +1 -1
- data/lib/stbaldricks/entities/lib/not_implemented_object.rb +4 -4
- data/lib/stbaldricks/entities/lib/payment.rb +14 -14
- data/lib/stbaldricks/entities/lib/phone.rb +3 -3
- data/lib/stbaldricks/entities/lib/third_party_media.rb +2 -2
- data/lib/stbaldricks/entities/lib/top_level.rb +4 -4
- data/lib/stbaldricks/entities/memorial.rb +3 -4
- data/lib/stbaldricks/entities/message.rb +8 -8
- data/lib/stbaldricks/entities/organization.rb +21 -21
- data/lib/stbaldricks/entities/page.rb +4 -6
- data/lib/stbaldricks/entities/participant.rb +58 -61
- data/lib/stbaldricks/entities/person.rb +97 -98
- data/lib/stbaldricks/entities/photo.rb +26 -26
- data/lib/stbaldricks/entities/recurring_gift.rb +18 -18
- data/lib/stbaldricks/entities/search.rb +8 -8
- data/lib/stbaldricks/entities/shave_schedule.rb +2 -2
- data/lib/stbaldricks/entities/team.rb +15 -18
- data/lib/stbaldricks/entities/user.rb +7 -5
- data/lib/stbaldricks/enums/cancer_types.rb +2 -0
- data/lib/stbaldricks/enums/country.rb +2 -0
- data/lib/stbaldricks/enums/league_status.rb +2 -0
- data/lib/stbaldricks/enums/model_type.rb +2 -0
- data/lib/stbaldricks/enums/permission.rb +8 -8
- data/lib/stbaldricks/enums/permission_model_type.rb +2 -0
- data/lib/stbaldricks/enums/province.rb +2 -0
- data/lib/stbaldricks/enums/state.rb +2 -0
- data/lib/stbaldricks/enums/top_level_category_type.rb +2 -0
- data/lib/stbaldricks/log.rb +3 -1
- data/lib/stbaldricks/patches/hash.rb +2 -2
- data/lib/stbaldricks/patches/string.rb +1 -1
- data/lib/stbaldricks/request.rb +3 -3
- data/lib/stbaldricks/version.rb +1 -1
- data/lib/stbaldricks_factories.rb +1 -1
- data/spec/factories/challenger.rb +2 -2
- data/spec/factories/kid.rb +3 -3
- data/spec/factories/kid_institution.rb +2 -2
- data/spec/factories/team.rb +2 -2
- metadata +88 -88
@@ -89,38 +89,38 @@ module SBF
|
|
89
89
|
attr_reader :original_filename
|
90
90
|
|
91
91
|
def to_json(*a)
|
92
|
-
to_hash.reject { |k, _v|
|
92
|
+
to_hash.reject { |k, _v| %i(file filename).include? k }.to_json(*a)
|
93
93
|
end
|
94
94
|
|
95
95
|
module Category
|
96
|
-
SHAVEE_AFTER = 'shavee_after'
|
97
|
-
SHAVEE_BEFORE = 'shavee_before'
|
98
|
-
KID = 'kid'
|
99
|
-
PARTICIPANT = 'participant'
|
100
|
-
TEAM_LOGO = 'team_logo'
|
101
|
-
VENUE_LOGO = 'venue_logo'
|
102
|
-
USER_AVATAR = 'user_avatar'
|
103
|
-
GALLERY = 'gallery'
|
104
|
-
DEFAULT_PHOTO = 'default_photo'
|
105
|
-
CAMPAIGN_LOGO = 'campaign_logo'
|
106
|
-
FUND_LOGO = 'fund_logo'
|
107
|
-
FUNDRAISER_LOGO = 'fundraiser_logo'
|
108
|
-
EVENT_SUPPORTER_LOGO = 'event_supporter_logo'
|
109
|
-
MEMORIAL = 'memorial'
|
110
|
-
COVER_ORIGINAL = 'cover_original'
|
111
|
-
COVER_DEFAULT = 'cover_default'
|
96
|
+
SHAVEE_AFTER = 'shavee_after'.freeze
|
97
|
+
SHAVEE_BEFORE = 'shavee_before'.freeze
|
98
|
+
KID = 'kid'.freeze
|
99
|
+
PARTICIPANT = 'participant'.freeze
|
100
|
+
TEAM_LOGO = 'team_logo'.freeze
|
101
|
+
VENUE_LOGO = 'venue_logo'.freeze
|
102
|
+
USER_AVATAR = 'user_avatar'.freeze
|
103
|
+
GALLERY = 'gallery'.freeze
|
104
|
+
DEFAULT_PHOTO = 'default_photo'.freeze
|
105
|
+
CAMPAIGN_LOGO = 'campaign_logo'.freeze
|
106
|
+
FUND_LOGO = 'fund_logo'.freeze
|
107
|
+
FUNDRAISER_LOGO = 'fundraiser_logo'.freeze
|
108
|
+
EVENT_SUPPORTER_LOGO = 'event_supporter_logo'.freeze
|
109
|
+
MEMORIAL = 'memorial'.freeze
|
110
|
+
COVER_ORIGINAL = 'cover_original'.freeze
|
111
|
+
COVER_DEFAULT = 'cover_default'.freeze
|
112
112
|
end
|
113
113
|
|
114
114
|
module ModelType
|
115
|
-
EVENT = 'event'
|
116
|
-
TEAM = 'team'
|
117
|
-
PARTICIPANT = 'participant'
|
118
|
-
FUNDRAISER = 'fundraiser'
|
119
|
-
KID = 'kid'
|
120
|
-
FUND = 'fund'
|
121
|
-
CAMPAIGN = 'campaign'
|
122
|
-
EVENT_SUPPORTER = 'event_supporter'
|
123
|
-
MEMORIAL = 'memorial'
|
115
|
+
EVENT = 'event'.freeze
|
116
|
+
TEAM = 'team'.freeze
|
117
|
+
PARTICIPANT = 'participant'.freeze
|
118
|
+
FUNDRAISER = 'fundraiser'.freeze
|
119
|
+
KID = 'kid'.freeze
|
120
|
+
FUND = 'fund'.freeze
|
121
|
+
CAMPAIGN = 'campaign'.freeze
|
122
|
+
EVENT_SUPPORTER = 'event_supporter'.freeze
|
123
|
+
MEMORIAL = 'memorial'.freeze
|
124
124
|
end
|
125
125
|
|
126
126
|
class FullParticipant < SBF::Client::FullParticipant
|
@@ -28,31 +28,31 @@ module SBF
|
|
28
28
|
attr_accessor :id
|
29
29
|
|
30
30
|
module Status
|
31
|
-
UNKNOWN = 'unknown'
|
32
|
-
PAST_DUE = 'past_due'
|
33
|
-
ACTIVE = 'active'
|
34
|
-
CANCELED = 'canceled'
|
35
|
-
PENDING = 'pending'
|
31
|
+
UNKNOWN = 'unknown'.freeze
|
32
|
+
PAST_DUE = 'past_due'.freeze
|
33
|
+
ACTIVE = 'active'.freeze
|
34
|
+
CANCELED = 'canceled'.freeze
|
35
|
+
PENDING = 'pending'.freeze
|
36
36
|
end
|
37
37
|
|
38
38
|
module RecipientType
|
39
|
-
FUND = 'fund'
|
40
|
-
EVENT = 'event'
|
41
|
-
TEAM = 'team'
|
42
|
-
PARTICIPANT = 'participant'
|
43
|
-
FUNDRAISER = 'fundraiser'
|
44
|
-
MEMORIAL = 'memorial'
|
39
|
+
FUND = 'fund'.freeze
|
40
|
+
EVENT = 'event'.freeze
|
41
|
+
TEAM = 'team'.freeze
|
42
|
+
PARTICIPANT = 'participant'.freeze
|
43
|
+
FUNDRAISER = 'fundraiser'.freeze
|
44
|
+
MEMORIAL = 'memorial'.freeze
|
45
45
|
end
|
46
46
|
|
47
47
|
module DonorType
|
48
|
-
INDIVIDUAL = 'individual'
|
49
|
-
BUSINESS = 'business'
|
50
|
-
ORGANIZATION_FOUNDATION = 'foundation'
|
48
|
+
INDIVIDUAL = 'individual'.freeze
|
49
|
+
BUSINESS = 'business'.freeze
|
50
|
+
ORGANIZATION_FOUNDATION = 'foundation'.freeze
|
51
51
|
end
|
52
52
|
|
53
53
|
module FundingType
|
54
|
-
CREDIT_CARD = 'credit_card'
|
55
|
-
PAYPAL = 'paypal'
|
54
|
+
CREDIT_CARD = 'credit_card'.freeze
|
55
|
+
PAYPAL = 'paypal'.freeze
|
56
56
|
end
|
57
57
|
|
58
58
|
class FullParticipant < SBF::Client::FullParticipant
|
@@ -169,8 +169,8 @@ module SBF
|
|
169
169
|
entity_attr_accessor :name_pieces, 'SBF::Client::NamePieces'
|
170
170
|
|
171
171
|
module Type
|
172
|
-
HONOR = 'honor'
|
173
|
-
MEMORY = 'memory'
|
172
|
+
HONOR = 'honor'.freeze
|
173
|
+
MEMORY = 'memory'.freeze
|
174
174
|
end
|
175
175
|
end
|
176
176
|
end
|
@@ -8,14 +8,14 @@ module SBF
|
|
8
8
|
action :find
|
9
9
|
|
10
10
|
module Type
|
11
|
-
FUND = 'fund'
|
12
|
-
CAMPAIGN = 'campaign'
|
13
|
-
EVENT = 'event'
|
14
|
-
TEAM = 'team'
|
15
|
-
PARTICIPANT = 'participant'
|
16
|
-
FUNDRAISER = 'fundraiser'
|
17
|
-
KID = 'kid'
|
18
|
-
MEMORIAL = 'memorial'
|
11
|
+
FUND = 'fund'.freeze
|
12
|
+
CAMPAIGN = 'campaign'.freeze
|
13
|
+
EVENT = 'event'.freeze
|
14
|
+
TEAM = 'team'.freeze
|
15
|
+
PARTICIPANT = 'participant'.freeze
|
16
|
+
FUNDRAISER = 'fundraiser'.freeze
|
17
|
+
KID = 'kid'.freeze
|
18
|
+
MEMORIAL = 'memorial'.freeze
|
19
19
|
end
|
20
20
|
|
21
21
|
module Status
|
@@ -12,10 +12,7 @@ require 'stbaldricks/entities/concerns/fundraising_page_concern'
|
|
12
12
|
module SBF
|
13
13
|
module Client
|
14
14
|
class Team < SBF::Client::TopLevelEntity
|
15
|
-
include Entities::DefaultCacheable
|
16
|
-
include DonationRecipientConcern
|
17
|
-
include EventYearConcern
|
18
|
-
include FundraisingPageConcern
|
15
|
+
include FundraisingPageConcern, EventYearConcern, DonationRecipientConcern, Entities::DefaultCacheable
|
19
16
|
actions DEFAULT_CRUD_ACTIONS
|
20
17
|
|
21
18
|
blacklist_action :create
|
@@ -23,26 +20,26 @@ module SBF
|
|
23
20
|
disallow_instantiation
|
24
21
|
|
25
22
|
module Status
|
26
|
-
ACTIVE = 'active'
|
27
|
-
PENDING = 'pending'
|
28
|
-
SUSPENDED = 'suspended'
|
23
|
+
ACTIVE = 'active'.freeze
|
24
|
+
PENDING = 'pending'.freeze
|
25
|
+
SUSPENDED = 'suspended'.freeze
|
29
26
|
end
|
30
27
|
|
31
28
|
module HowCreated
|
32
|
-
WEBSITE = 'website'
|
33
|
-
ADMIN_IMPORT = 'admin_import'
|
34
|
-
ADMIN_CONTROL_PANEL = 'admin_control_panel'
|
35
|
-
MOBILE = 'mobile'
|
36
|
-
PARTICIPANT_IMPORT = 'participant_import'
|
29
|
+
WEBSITE = 'website'.freeze
|
30
|
+
ADMIN_IMPORT = 'admin_import'.freeze
|
31
|
+
ADMIN_CONTROL_PANEL = 'admin_control_panel'.freeze
|
32
|
+
MOBILE = 'mobile'.freeze
|
33
|
+
PARTICIPANT_IMPORT = 'participant_import'.freeze
|
37
34
|
end
|
38
35
|
|
39
36
|
module FundRelationshipType
|
40
|
-
NO_ASSOCIATION = 'no_association'
|
41
|
-
INDIRECT_ONE = 'indirect_one'
|
42
|
-
INDIRECT_MULTIPLE = 'indirect_multiple'
|
43
|
-
DIRECT = 'direct'
|
44
|
-
DIRECT_BUT_LOCKED = 'direct_but_locked'
|
45
|
-
INHERITED_FROM_EVENT = 'inherited_from_event'
|
37
|
+
NO_ASSOCIATION = 'no_association'.freeze
|
38
|
+
INDIRECT_ONE = 'indirect_one'.freeze
|
39
|
+
INDIRECT_MULTIPLE = 'indirect_multiple'.freeze
|
40
|
+
DIRECT = 'direct'.freeze
|
41
|
+
DIRECT_BUT_LOCKED = 'direct_but_locked'.freeze
|
42
|
+
INHERITED_FROM_EVENT = 'inherited_from_event'.freeze
|
46
43
|
end
|
47
44
|
|
48
45
|
class Photos < SBF::Client::BaseEntity
|
@@ -20,20 +20,22 @@ module SBF
|
|
20
20
|
cache_id_from_hash ->(h) { [h[:person][:id], h[:type]] }
|
21
21
|
|
22
22
|
module AccessScope
|
23
|
-
ADMIN = 'admin'
|
24
|
-
MEMBER = 'member'
|
23
|
+
ADMIN = 'admin'.freeze
|
24
|
+
MEMBER = 'member'.freeze
|
25
25
|
end
|
26
26
|
|
27
27
|
module ProviderType
|
28
|
-
SBF = 'sbf'
|
29
|
-
FACEBOOK = 'facebook'
|
30
|
-
TWITTER = 'twitter'
|
28
|
+
SBF = 'sbf'.freeze
|
29
|
+
FACEBOOK = 'facebook'.freeze
|
30
|
+
TWITTER = 'twitter'.freeze
|
31
31
|
|
32
|
+
# rubocop:disable Style/MutableConstant
|
32
33
|
IDS = {
|
33
34
|
SBF => 1,
|
34
35
|
FACEBOOK => 2,
|
35
36
|
TWITTER => 3
|
36
37
|
}
|
38
|
+
# rubocop:enable Style/MutableConstant
|
37
39
|
IDS.default = 0
|
38
40
|
IDS.freeze
|
39
41
|
|
@@ -18,7 +18,7 @@ module SBF
|
|
18
18
|
|
19
19
|
MANAGE_SYSTEM = 109
|
20
20
|
|
21
|
-
#Event permissions
|
21
|
+
# Event permissions
|
22
22
|
EVENT_MANAGE = 200
|
23
23
|
EVENT_MANAGE_INFO = 201
|
24
24
|
EVENT_MANAGE_ACTIVITIES = 202
|
@@ -42,7 +42,7 @@ module SBF
|
|
42
42
|
EVENT_FAST_REGISTRATION = 220
|
43
43
|
EVENT_DELETE_EVENT = 221
|
44
44
|
|
45
|
-
#text descriptions found in LookupUtility
|
45
|
+
# text descriptions found in LookupUtility
|
46
46
|
EVENT_MEMBER_UPDATE_EVENT_INFORMATION = 300
|
47
47
|
EVENT_MEMBER_ACTIVITIES = 301
|
48
48
|
EVENT_MEMBER_PHOTO_GALLERY = 302
|
@@ -60,7 +60,7 @@ module SBF
|
|
60
60
|
EVENT_MEMBER_COMMUNICATE = 315
|
61
61
|
EVENT_MEMBER_FAST_DONATION = 316
|
62
62
|
|
63
|
-
#Participant Role Permissions
|
63
|
+
# Participant Role Permissions
|
64
64
|
EVENT_ORGANIZER = 1905
|
65
65
|
EVENT_BARBER_COORDINATOR = 1911
|
66
66
|
EVENT_SHAVEE_RECRUITER = 1913
|
@@ -115,7 +115,7 @@ module SBF
|
|
115
115
|
|
116
116
|
EVENT_APPLICATION_MANAGE = 2202
|
117
117
|
|
118
|
-
#Team Permissions
|
118
|
+
# Team Permissions
|
119
119
|
TEAM_TEAM_CAPTAIN = 2101
|
120
120
|
|
121
121
|
# Memorial Permissions
|
@@ -140,7 +140,7 @@ module SBF
|
|
140
140
|
DELETE_GROUPS => :DELETE_GROUPS,
|
141
141
|
EDIT_GROUPS => :EDIT_GROUPS,
|
142
142
|
MANAGE_SYSTEM => :MANAGE_SYSTEM,
|
143
|
-
#Event permissions
|
143
|
+
# Event permissions
|
144
144
|
EVENT_MANAGE => :EVENT_MANAGE,
|
145
145
|
EVENT_MANAGE_INFO => :EVENT_MANAGE_INFO,
|
146
146
|
EVENT_MANAGE_ACTIVITIES => :EVENT_MANAGE_ACTIVITIES,
|
@@ -179,7 +179,7 @@ module SBF
|
|
179
179
|
EVENT_MEMBER_VIEW_TEAM_TOTALS_LIST => :EVENT_MEMBER_VIEW_TEAM_TOTALS_LIST,
|
180
180
|
EVENT_MEMBER_COMMUNICATE => :EVENT_MEMBER_COMMUNICATE,
|
181
181
|
EVENT_MEMBER_FAST_DONATION => :EVENT_MEMBER_FAST_DONATION,
|
182
|
-
#Participant Role Permissions
|
182
|
+
# Participant Role Permissions
|
183
183
|
EVENT_ORGANIZER => :EVENT_ORGANIZER,
|
184
184
|
EVENT_BARBER_COORDINATOR => :EVENT_BARBER_COORDINATOR,
|
185
185
|
EVENT_SHAVEE_RECRUITER => :EVENT_SHAVEE_RECRUITER,
|
@@ -211,9 +211,9 @@ module SBF
|
|
211
211
|
FUNDRAISER_MANAGE => :FUNDRAISER_MANAGE,
|
212
212
|
FUNDRAISER_DELETE_FUNDRAISER => :FUNDRAISER_DELETE_FUNDRAISER,
|
213
213
|
EVENT_APPLICATION_MANAGE => :EVENT_APPLICATION_MANAGE,
|
214
|
-
#Team Permissions
|
214
|
+
# Team Permissions
|
215
215
|
TEAM_TEAM_CAPTAIN => :TEAM_TEAM_CAPTAIN,
|
216
|
-
#Memorial Permissions
|
216
|
+
# Memorial Permissions
|
217
217
|
MEMORIAL_VIEW => :MEMORIAL_VIEW,
|
218
218
|
MEMORIAL_MANAGE => :MEMORIAL_MANAGE,
|
219
219
|
# Challenge Permissions
|
data/lib/stbaldricks/log.rb
CHANGED
@@ -6,7 +6,9 @@ module SBF
|
|
6
6
|
class LOG
|
7
7
|
include Singleton
|
8
8
|
|
9
|
-
|
9
|
+
# rubocop:disable Style/MutableConstant
|
10
|
+
REQUIRED_METHODS = %i(debug info warn error fatal unknown add level)
|
11
|
+
# rubocop:enable Style/MutableConstant
|
10
12
|
|
11
13
|
# rubocop:disable Style/MethodMissingSuper, Style/MissingRespondToMissing
|
12
14
|
def self.method_missing(sym, *args, &block)
|
@@ -3,9 +3,9 @@ class Hash
|
|
3
3
|
keys.each do |key|
|
4
4
|
unless key.is_a? Symbol
|
5
5
|
value = delete(key)
|
6
|
-
# rubocop:disable RescueModifier
|
6
|
+
# rubocop:disable Style/RescueModifier
|
7
7
|
self[(key.to_sym rescue key) || key] = value
|
8
|
-
# rubocop:enable RescueModifier
|
8
|
+
# rubocop:enable Style/RescueModifier
|
9
9
|
end
|
10
10
|
|
11
11
|
value.symbolize! if value.is_a?(Hash) || value.is_a?(Array)
|
data/lib/stbaldricks/request.rb
CHANGED
@@ -7,15 +7,15 @@ require 'uri'
|
|
7
7
|
|
8
8
|
# Require all monkey patches
|
9
9
|
patch_dir = File.realpath("#{File.dirname(__FILE__)}/patches/")
|
10
|
-
Dir["#{patch_dir}/*.rb"].each { |file| require file }
|
10
|
+
Dir["#{patch_dir}/*.rb"].sort.each { |file| require file }
|
11
11
|
|
12
12
|
# Require all entities
|
13
13
|
entity_dir = File.realpath("#{File.dirname(__FILE__)}/entities/")
|
14
|
-
Dir["#{entity_dir}/**/*.rb"].each { |file| require file }
|
14
|
+
Dir["#{entity_dir}/**/*.rb"].sort.each { |file| require file }
|
15
15
|
|
16
16
|
# Require all enums
|
17
17
|
enum_dir = File.realpath("#{File.dirname(__FILE__)}/enums/")
|
18
|
-
Dir["#{enum_dir}/*.rb"].each { |file| require file }
|
18
|
+
Dir["#{enum_dir}/*.rb"].sort.each { |file| require file }
|
19
19
|
|
20
20
|
# Client library class for accessing the St. Baldrick's Foundation API
|
21
21
|
module SBF
|
data/lib/stbaldricks/version.rb
CHANGED
@@ -2,4 +2,4 @@ require 'stbaldricks'
|
|
2
2
|
|
3
3
|
project_root = File.realpath("#{File.dirname(__FILE__)}/../")
|
4
4
|
$LOAD_PATH.unshift(project_root)
|
5
|
-
Dir["#{project_root}/spec/factories/**/*.rb"].each { |file| require file }
|
5
|
+
Dir["#{project_root}/spec/factories/**/*.rb"].sort.each { |file| require file }
|
@@ -2,9 +2,9 @@ require_relative 'lib/helpers'
|
|
2
2
|
|
3
3
|
FactoryBot.define do
|
4
4
|
factory :_base_challenger, class: SBF::Client::Challenger do
|
5
|
-
to_create
|
5
|
+
to_create do |it|
|
6
6
|
raise "Failed to create #{it.class}: #{it.errors.details}" unless it.save
|
7
|
-
|
7
|
+
end
|
8
8
|
|
9
9
|
initialize_with do
|
10
10
|
new(attributes)
|
data/spec/factories/kid.rb
CHANGED
@@ -2,10 +2,10 @@ require_relative 'lib/helpers'
|
|
2
2
|
|
3
3
|
FactoryBot.define do
|
4
4
|
factory :kid, class: SBF::Client::FullKid do
|
5
|
-
to_create
|
5
|
+
to_create do |it|
|
6
6
|
it.relationships.first.person = FactoryBot.create(:person) if it.relationships.first.person.nil?
|
7
7
|
raise "Failed to create #{it.class}: #{it.errors.details}" unless it.save
|
8
|
-
|
8
|
+
end
|
9
9
|
|
10
10
|
initialize_with do
|
11
11
|
new(attributes)
|
@@ -19,7 +19,7 @@ FactoryBot.define do
|
|
19
19
|
after :build do |kid, evaluator|
|
20
20
|
kid.name_pieces = build(:name_pieces) if unpopulated?(evaluator, :name_pieces)
|
21
21
|
kid.address = build(:address) if unpopulated?(evaluator, :address)
|
22
|
-
kid.diagnosis = build(:diagnosis) if unpopulated?(evaluator, :diagnosis)
|
22
|
+
kid.diagnosis = build(:diagnosis, date: Faker::Date.between(from: kid.birthday, to: DateTime.now).to_s) if unpopulated?(evaluator, :diagnosis)
|
23
23
|
kid.treatment_status = build(:treatment_status) if unpopulated?(evaluator, :treatment_status)
|
24
24
|
kid.web_page = build(:web_page) if unpopulated?(evaluator, :web_page)
|
25
25
|
kid.photos = build(:photos) if unpopulated?(evaluator, :photos)
|