mas-rad_core 0.0.53 → 0.0.54
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/app/models/firm.rb +5 -2
- data/app/models/principal.rb +2 -1
- data/lib/mas/rad_core/version.rb +1 -1
- data/spec/dummy/log/development.log +54 -0
- data/spec/dummy/log/test.log +70832 -0
- data/spec/factories/firm.rb +7 -3
- data/spec/models/firm_spec.rb +3 -3
- data/spec/models/principal_spec.rb +8 -0
- metadata +2 -2
data/spec/factories/firm.rb
CHANGED
@@ -30,8 +30,10 @@ FactoryGirl.define do
|
|
30
30
|
latitude { Faker::Address.latitude.to_f.round(6) }
|
31
31
|
longitude { Faker::Address.longitude.to_f.round(6) }
|
32
32
|
|
33
|
-
factory :
|
33
|
+
factory :trading_name do
|
34
34
|
parent factory: Firm
|
35
|
+
|
36
|
+
factory :subsidiary
|
35
37
|
end
|
36
38
|
|
37
39
|
factory :firm_with_no_business_split do
|
@@ -48,8 +50,10 @@ FactoryGirl.define do
|
|
48
50
|
advisers { create_list(:adviser, 3) }
|
49
51
|
end
|
50
52
|
|
51
|
-
factory :
|
52
|
-
subsidiaries { create_list(:
|
53
|
+
factory :firm_with_trading_names do
|
54
|
+
subsidiaries { create_list(:trading_name, 3, fca_number: fca_number) }
|
55
|
+
|
56
|
+
factory :firm_with_subsidiaries
|
53
57
|
end
|
54
58
|
|
55
59
|
factory :firm_with_principal do
|
data/spec/models/firm_spec.rb
CHANGED
@@ -284,7 +284,7 @@ RSpec.describe Firm do
|
|
284
284
|
end
|
285
285
|
|
286
286
|
context 'when the firm has subsidiaries' do
|
287
|
-
let(:firm) { create(:
|
287
|
+
let(:firm) { create(:firm_with_trading_names) }
|
288
288
|
|
289
289
|
it 'cascades destroy to subsidiaries' do
|
290
290
|
subsidiary = firm.subsidiaries.first
|
@@ -297,11 +297,11 @@ RSpec.describe Firm do
|
|
297
297
|
context 'when the firm has a principal' do
|
298
298
|
let(:firm) { create(:firm_with_principal) }
|
299
299
|
|
300
|
-
it '
|
300
|
+
it 'does not destroy the principal' do
|
301
301
|
principal = firm.principal
|
302
302
|
firm.destroy
|
303
303
|
firm.run_callbacks(:commit)
|
304
|
-
expect(Principal.where(token: principal.id)).
|
304
|
+
expect(Principal.where(token: principal.id)).not_to be_empty
|
305
305
|
end
|
306
306
|
end
|
307
307
|
|
@@ -204,4 +204,12 @@ RSpec.describe Principal do
|
|
204
204
|
expect(principal.field_order).to contain_exactly(*fields)
|
205
205
|
end
|
206
206
|
end
|
207
|
+
|
208
|
+
describe '#destroy' do
|
209
|
+
it 'cascades to the firm' do
|
210
|
+
firm = principal.firm
|
211
|
+
principal.destroy
|
212
|
+
expect(Firm.where(id: firm.id)).to be_empty
|
213
|
+
end
|
214
|
+
end
|
207
215
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: mas-rad_core
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.54
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ben Lovell
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-06-
|
11
|
+
date: 2015-06-03 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|