unidom-visitor 1.13.4 → 1.13.5

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 29f640ac2c868be349d60215948410335e3ac4e4
4
- data.tar.gz: eea7eff56cadbc743c323b73a55c9fe617c95618
3
+ metadata.gz: 1548e1bbdb03bf173876665278c0f89b3b780212
4
+ data.tar.gz: aa7195117c0aa319e0a7e199de9b40388c1b7845
5
5
  SHA512:
6
- metadata.gz: 961e6e04e663981774c00e5bcbf48fa2756a3f286073c976fa168057e934de74d3a768df1559d1f3280026dc2158bceeba4d161390f8de4c8eaad9e2a634c9ae
7
- data.tar.gz: 7e5e5d922a7715fae18c9102b6db58c1223cc3db8bcb5b3c95509571165e59099b0b7ee25256fb2e6c00cbcbd1f916714d44292a93615ec1b11476a6acbf6b24
6
+ metadata.gz: f6ac8dbce79296442cb7f32308e994059bbd654c14cbe9c294cbb9ae64b8663a2f2b39ea6b7da0808f946d9e30d12d4b2a5b43f90d218d60ce82aee43094ae09
7
+ data.tar.gz: 6549bc235bb223f97f522acd955b167f4b802f2f96a6b18ee92d65d58bae0de8b6f8a27dfdef466bfc404077b5ba5c63dcd7c10918ff79f0b3854dab3a7fa1b0
@@ -13,6 +13,10 @@ class Unidom::Visitor::Identificating < Unidom::Visitor::ApplicationRecord
13
13
  scope :identity_is, ->(identity) { where identity: identity }
14
14
  scope :visitor_is, ->(visitor) { where visitor: visitor }
15
15
 
16
+ ##
17
+ # 根据访问者 visitor ,找到其对应的登录身份标示 identity (如手机号码或自定义用户名)。如:
18
+ # mobile_phone_number = Unidom::Visitor::Identificating.find_identity user
19
+ # puts mobile_phone_number.phone_number
16
20
  def self.find_identity(visitor)
17
21
  visitor_is(visitor).first.try :identity
18
22
  end
@@ -13,26 +13,10 @@ describe Unidom::Visitor::Guest, type: :model do
13
13
  platform_specific_identification: '123456789012'
14
14
  }
15
15
 
16
- platform_specific_identification_max_length = described_class.columns_hash['platform_specific_identification'].limit
17
-
18
16
  it_behaves_like 'Unidom::Common::Concerns::ModelExtension', model_attributes
19
17
 
20
- it_behaves_like 'validates', model_attributes, :platform_specific_identification,
21
- { } => 0,
22
- { platform_specific_identification: nil } => 2,
23
- { platform_specific_identification: '' } => 2,
24
- { platform_specific_identification: '1' } => 1,
25
- { platform_specific_identification: 'A' } => 1,
26
- { platform_specific_identification: '11' } => 0,
27
- { platform_specific_identification: 'AA' } => 0,
28
- { platform_specific_identification: '111' } => 0,
29
- { platform_specific_identification: 'AAA' } => 0,
30
- { platform_specific_identification: '1'*(platform_specific_identification_max_length-1) } => 0,
31
- { platform_specific_identification: 'A'*(platform_specific_identification_max_length-1) } => 0,
32
- { platform_specific_identification: '1'*platform_specific_identification_max_length } => 0,
33
- { platform_specific_identification: 'A'*platform_specific_identification_max_length } => 0,
34
- { platform_specific_identification: '1'*(platform_specific_identification_max_length+1) } => 1,
35
- { platform_specific_identification: 'A'*(platform_specific_identification_max_length+1) } => 1
18
+ it_behaves_like 'validates text', model_attributes, :platform_specific_identification,
19
+ length: 2..described_class.columns_hash['platform_specific_identification'].limit
36
20
 
37
21
  new_platform_specific_identification = 'ABCDEFGHIJKLMNOP'
38
22
  it_behaves_like 'scope', :platform_specific_identification_is, [
@@ -12,28 +12,12 @@ describe Unidom::Visitor::Password, type: :model do
12
12
  clear_text: 'password'
13
13
  }
14
14
 
15
- clear_text_max_length = 200
16
- pepper_content_max_length = described_class.columns_hash['pepper_content'].limit
17
-
18
15
  it_behaves_like 'Unidom::Common::Concerns::ModelExtension', model_attributes
19
16
 
20
- it_behaves_like 'validates', model_attributes, :clear_text,
21
- { } => 0,
22
- { clear_text: nil } => 2,
23
- { clear_text: '' } => 2,
24
- { clear_text: '1'*5 } => 1,
25
- { clear_text: 'A'*5 } => 1,
26
- { clear_text: '1'*6 } => 0,
27
- { clear_text: 'A'*6 } => 0,
28
- { clear_text: '1'*7 } => 0,
29
- { clear_text: 'A'*7 } => 0,
30
- { clear_text: '1'*(clear_text_max_length-1) } => 0,
31
- { clear_text: 'A'*(clear_text_max_length-1) } => 0,
32
- { clear_text: '1'*clear_text_max_length } => 0,
33
- { clear_text: 'A'*clear_text_max_length } => 0,
34
- { clear_text: '1'*(clear_text_max_length+1) } => 1,
35
- { clear_text: 'A'*(clear_text_max_length+1) } => 1
17
+ it_behaves_like 'validates text', model_attributes, :clear_text,
18
+ length: 6..200
36
19
 
20
+ pepper_content_max_length = described_class.columns_hash['pepper_content'].limit
37
21
  it_behaves_like 'validates', model_attributes, :pepper_content,
38
22
  { } => 0,
39
23
  { pepper_content: nil } => 0,
@@ -1,5 +1,5 @@
1
1
  module Unidom
2
2
  module Visitor
3
- VERSION = '1.13.4'.freeze
3
+ VERSION = '1.13.5'.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.4
4
+ version: 1.13.5
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-03-15 00:00:00.000000000 Z
11
+ date: 2017-03-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: unidom-common