dorsale 3.7.7 → 3.7.8
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +4 -0
- data/app/models/dorsale/customer_vault/person.rb +2 -1
- data/lib/dorsale/version.rb +1 -1
- data/spec/models/dorsale/customer_vault/person_spec.rb +21 -2
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ecb41bb191b0f0774874ccda3e131cb20eea812c
|
4
|
+
data.tar.gz: c6dd41119b5126fbff10a4cd72224139cc15dde3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3a5363b33345add30d2dc9e89aed9e4570b92b807f663da687cd3333f35436ad0a66cab48f6f6adbf86aed106192503ee941c710708c89b32c3bfbfc72ab743d
|
7
|
+
data.tar.gz: c78f2865a7de1834dd91396a0246c7c6c168564abe73ccce52dff0917c0141652b02f1269745d29719782f5149f546bd5dec0a0fd370bff180794da9dd085337
|
data/CHANGELOG.md
CHANGED
@@ -36,7 +36,8 @@ class Dorsale::CustomerVault::Person < ::Dorsale::ApplicationRecord
|
|
36
36
|
order("LOWER(COALESCE(corporation_name, '') || COALESCE(last_name, '') || COALESCE(first_name, '')) ASC")
|
37
37
|
}
|
38
38
|
|
39
|
-
after_initialize
|
39
|
+
after_initialize :build_address, if: proc { new_record? && address.nil? }
|
40
|
+
before_validation :build_address, if: proc { address.nil? }
|
40
41
|
|
41
42
|
def person_type
|
42
43
|
self.class.to_s.demodulize.downcase.to_sym
|
data/lib/dorsale/version.rb
CHANGED
@@ -37,9 +37,28 @@ RSpec.describe ::Dorsale::CustomerVault::Person, type: :model do
|
|
37
37
|
end
|
38
38
|
|
39
39
|
describe "address" do
|
40
|
-
|
40
|
+
let(:person_without_address) {
|
41
41
|
corporation = Dorsale::CustomerVault::Corporation.create!(name: "agilidée")
|
42
|
-
|
42
|
+
corporation.address.destroy
|
43
|
+
corporation
|
44
|
+
}
|
45
|
+
|
46
|
+
it "should auto create address on build" do
|
47
|
+
corporation = Dorsale::CustomerVault::Corporation.new
|
48
|
+
expect(corporation.address).to be_present
|
49
|
+
end
|
50
|
+
|
51
|
+
it "should NOT auto create address on find" do
|
52
|
+
corporation = Dorsale::CustomerVault::Corporation.find(person_without_address.id)
|
53
|
+
expect(corporation.address).to be_nil
|
54
|
+
end
|
55
|
+
|
56
|
+
it "should auto create address before validation" do
|
57
|
+
corporation = Dorsale::CustomerVault::Corporation.find(person_without_address.id)
|
58
|
+
expect(corporation.address).to be_nil
|
59
|
+
|
60
|
+
corporation.save!
|
61
|
+
expect(corporation.address).to be_present
|
43
62
|
end
|
44
63
|
end # describe "address"
|
45
64
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: dorsale
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.7.
|
4
|
+
version: 3.7.8
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- agilidée
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-10-
|
11
|
+
date: 2017-10-12 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|