unidom-visitor 1.13.8 → 1.13.9

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: c763c992d58b86e7d7535122572868fe7e07613d
4
- data.tar.gz: 3296ec7134c93ce575234f426656ef1a3a13707c
3
+ metadata.gz: 8d0ac2767f45bcf47df28c535c0a19437f2d59d8
4
+ data.tar.gz: 1fad2beee13c6c4455e57757047f88bc2cde3b33
5
5
  SHA512:
6
- metadata.gz: cde7d434e1145aa8bf53844cb98218bcbca72a866f1b1700565b863172a5ccac4e650c35df73e72745c7991074ba00b5f8fe3d2bb04196dbfb17e832f513a110
7
- data.tar.gz: e0a7de6b199856c6c2a09bed507e065870c6787f6162fe2544e275d37abaa3ea1fe9dd0d934524f84ad833ad5bcf9f200706f3db85fac709ca7e362b9af76fef
6
+ metadata.gz: 9e2fd44cbd3e80b1b029686ffb36a61b04fafa985a5dc1a334cd72aa4d36080e051287f3caf864ba15026292f18b2b8f530697af14c56277e820e714316b22f5
7
+ data.tar.gz: 44d51c341110a9755011e5faeeadf281bfc9df2f6f2fedc2519eabfeebd6b4919d3df197703541f98e93fc1eafec1ae9a78a09ecdb9d8e80b704d93f7898e54a
data/README.md CHANGED
@@ -178,6 +178,13 @@ require 'unidom/visitor/validators_rspec'
178
178
  ```ruby
179
179
  # The Unidom::Visitor::Password model already include the Unidom::Visitor::Concerns::AsCredential concern
180
180
 
181
+ # lib/unidom.rb
182
+ Unidom::Contact::EmailAddress.class_eval do
183
+
184
+ include Unidom::Visitor::Concerns::AsIdentity
185
+
186
+ end
187
+
181
188
  # app/models/your_credential.rb
182
189
  class YourCredential < ApplicationRecord
183
190
 
@@ -198,5 +205,20 @@ describe YourCredential, type: :model do
198
205
 
199
206
  it_behaves_like 'Unidom::Visitor::Concerns::AsCredential', model_attribtues
200
207
 
208
+ end
209
+
210
+ # spec/models/unidom/contact/email_address_spec.rb
211
+ describe Unidom::Contact::EmailAddress, type: :model do
212
+
213
+ context do
214
+
215
+ model_attribtues = {
216
+ full_address: "#{SecureRandom.hex 16}@#{SecureRandom.hex 8}.com"
217
+ }
218
+
219
+ it_behaves_like 'Unidom::Visitor::Concerns::AsIdentity', model_attribtues
220
+
221
+ end
222
+
201
223
  end
202
224
  ```
@@ -1,13 +1,18 @@
1
1
  module Unidom::Visitor::Concerns::AsIdentity
2
2
 
3
- extend ActiveSupport::Concern
3
+ extend ActiveSupport::Concern
4
+ include Unidom::Common::Concerns::ArgumentValidation
4
5
 
5
6
  included do |includer|
6
7
 
7
8
  has_many :identificatings, class_name: 'Unidom::Visitor::Identificating', as: :identity
8
9
 
9
10
  def identificate!(it, at: Time.now)
11
+
12
+ assert_present! :it, it
13
+
10
14
  identificatings.create! visitor: it, opened_at: at
15
+
11
16
  end
12
17
 
13
18
  def identificate?(it, at: Time.now)
@@ -0,0 +1,17 @@
1
+ shared_examples 'Unidom::Visitor::Concerns::AsIdentity' do |model_attributes|
2
+
3
+ context do
4
+
5
+ identificating_1_attributes = {
6
+ visitor: Unidom::Visitor::User.create!
7
+ }
8
+
9
+ identificating_2_attributes = {
10
+ visitor: Unidom::Visitor::User.create!
11
+ }
12
+
13
+ it_behaves_like 'has_many', model_attributes, :identificatings, Unidom::Visitor::Identificating, [ identificating_1_attributes, identificating_2_attributes ]
14
+
15
+ end
16
+
17
+ end
@@ -1 +1,2 @@
1
1
  require 'rspec/models/unidom/visitor/concerns/as_credential_shared_examples'
2
+ require 'rspec/models/unidom/visitor/concerns/as_identity_shared_examples'
@@ -1,5 +1,5 @@
1
1
  module Unidom
2
2
  module Visitor
3
- VERSION = '1.13.8'.freeze
3
+ VERSION = '1.13.9'.freeze
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: unidom-visitor
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.13.8
4
+ version: 1.13.9
5
5
  platform: ruby
6
6
  authors:
7
7
  - Topbit Du
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-04-14 00:00:00.000000000 Z
11
+ date: 2017-04-24 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: unidom-common
@@ -67,6 +67,7 @@ files:
67
67
  - db/migrate/20000220000000_create_unidom_passwords.rb
68
68
  - lib/rspec/models/unidom/visitor/authenticating_spec.rb
69
69
  - lib/rspec/models/unidom/visitor/concerns/as_credential_shared_examples.rb
70
+ - lib/rspec/models/unidom/visitor/concerns/as_identity_shared_examples.rb
70
71
  - lib/rspec/models/unidom/visitor/guest_spec.rb
71
72
  - lib/rspec/models/unidom/visitor/identificating_spec.rb
72
73
  - lib/rspec/models/unidom/visitor/password_spec.rb