dorsale 3.7.7 → 3.7.8

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 76b8dc71431e1a245a94bd289e89624b8125827b
4
- data.tar.gz: 5c1c72b5535774ed5dffc5ae8b582bab5f554283
3
+ metadata.gz: ecb41bb191b0f0774874ccda3e131cb20eea812c
4
+ data.tar.gz: c6dd41119b5126fbff10a4cd72224139cc15dde3
5
5
  SHA512:
6
- metadata.gz: 4d83ab74ba603fd01a7352ec1027a8882b52b42bbbadf85ad41395d95fe6dfb018d80b2d61550b8b7b992806ac3522019e179fae1444c5ed8a8c3886f62c5c94
7
- data.tar.gz: 6dbfc36f1024d85150d9d3998f93537c8758ec6c8100036b4251fcc0af1733492ea849d123bbdbb46dc2ecb3312a3fa4a1030dccf1e4d60ee37f638ca4dac50e
6
+ metadata.gz: 3a5363b33345add30d2dc9e89aed9e4570b92b807f663da687cd3333f35436ad0a66cab48f6f6adbf86aed106192503ee941c710708c89b32c3bfbfc72ab743d
7
+ data.tar.gz: c78f2865a7de1834dd91396a0246c7c6c168564abe73ccce52dff0917c0141652b02f1269745d29719782f5149f546bd5dec0a0fd370bff180794da9dd085337
data/CHANGELOG.md CHANGED
@@ -2,6 +2,10 @@
2
2
 
3
3
  ## Next version
4
4
 
5
+ ## 3.7.8
6
+
7
+ - Person build address improvement
8
+
5
9
  ## 3.7.7
6
10
 
7
11
  - Change redirect after create task comment
@@ -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 :build_address, unless: :address
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
@@ -1,3 +1,3 @@
1
1
  module Dorsale
2
- VERSION = "3.7.7"
2
+ VERSION = "3.7.8"
3
3
  end
@@ -37,9 +37,28 @@ RSpec.describe ::Dorsale::CustomerVault::Person, type: :model do
37
37
  end
38
38
 
39
39
  describe "address" do
40
- it "should auto create address" do
40
+ let(:person_without_address) {
41
41
  corporation = Dorsale::CustomerVault::Corporation.create!(name: "agilidée")
42
- expect(corporation.address).to_not be nil
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.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 00:00:00.000000000 Z
11
+ date: 2017-10-12 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails