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:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8d0ac2767f45bcf47df28c535c0a19437f2d59d8
|
4
|
+
data.tar.gz: 1fad2beee13c6c4455e57757047f88bc2cde3b33
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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
|
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
|
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.
|
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-
|
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
|