mas-rad_core 0.0.45 → 0.0.46

Sign up to get free protection for your applications and to get access to all the features.
@@ -2,6 +2,10 @@ FactoryGirl.define do
2
2
  sequence(:reference_number, 10000) { |n| "ABC#{n}" }
3
3
 
4
4
  factory :adviser do
5
+ transient do
6
+ create_linked_lookup_advisor true
7
+ end
8
+
5
9
  reference_number
6
10
  name 'Ben Lovell'
7
11
  postcode 'RG1 1NN'
@@ -14,8 +18,8 @@ FactoryGirl.define do
14
18
  before(:create) { |a| a.class.skip_callback(:save, :after, :geocode) }
15
19
  after(:create) { |a| a.class.set_callback(:save, :after, :geocode, if: :valid?) }
16
20
 
17
- after(:build) do |a|
18
- if a.reference_number?
21
+ after(:build) do |a, evaluator|
22
+ if a.reference_number? && evaluator.create_linked_lookup_advisor
19
23
  Lookup::Adviser.create!(
20
24
  reference_number: a.reference_number,
21
25
  name: a.name
@@ -79,7 +79,9 @@ RSpec.describe Adviser do
79
79
  %w(badtimes ABCDEFGH 8008135! 12345678).each do |bad|
80
80
  Lookup::Adviser.create!(reference_number: bad, name: 'Mr. Derp')
81
81
 
82
- expect(build(:adviser, reference_number: bad)).to_not be_valid
82
+ expect(build(:adviser,
83
+ reference_number: bad,
84
+ create_linked_lookup_advisor: false)).to_not be_valid
83
85
  end
84
86
  end
85
87
 
@@ -99,7 +101,9 @@ RSpec.describe Adviser do
99
101
  end
100
102
 
101
103
  it 'must not be valid' do
102
- expect(build(:adviser, reference_number: reference_number)).to_not be_valid
104
+ expect(build(:adviser,
105
+ reference_number: reference_number,
106
+ create_linked_lookup_advisor: false)).to_not be_valid
103
107
  end
104
108
  end
105
109
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mas-rad_core
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.45
4
+ version: 0.0.46
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ben Lovell
@@ -279,6 +279,7 @@ files:
279
279
  - db/migrate/20150222092417_add_latitude_and_longitude_to_advisers.rb
280
280
  - db/migrate/20150228095315_add_cy_name_to_other_advice_methods.rb
281
281
  - db/migrate/20150305150719_add_cy_name_to_investment_size.rb
282
+ - db/migrate/20150423154732_add_index_on_lookup_advisers_reference_number.rb
282
283
  - lib/mas/elastic_search_client.rb
283
284
  - lib/mas/firm_repository.rb
284
285
  - lib/mas/firm_result.rb
@@ -321,6 +322,7 @@ files:
321
322
  - spec/dummy/config/routes.rb
322
323
  - spec/dummy/config/secrets.yml
323
324
  - spec/dummy/db/schema.rb
325
+ - spec/dummy/log/development.log
324
326
  - spec/dummy/log/test.log
325
327
  - spec/dummy/public/404.html
326
328
  - spec/dummy/public/422.html
@@ -433,6 +435,7 @@ test_files:
433
435
  - spec/dummy/config/secrets.yml
434
436
  - spec/dummy/config.ru
435
437
  - spec/dummy/db/schema.rb
438
+ - spec/dummy/log/development.log
436
439
  - spec/dummy/log/test.log
437
440
  - spec/dummy/public/404.html
438
441
  - spec/dummy/public/422.html