unidom-visitor 1.13 → 1.13.1

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: c0b71f31b70c576cbac3a818087a3e8fc11167cb
4
- data.tar.gz: 9e117c82270f65cdd0ee725b2ded78e634cd3de2
3
+ metadata.gz: 1fdf63ec0d7a2854a1973586c2cfb0a6ed987e5a
4
+ data.tar.gz: 59f059005576855efcf740e3588cfd804f49b358
5
5
  SHA512:
6
- metadata.gz: 0cf99de934c780bd8c556a7385609904f91978de150f890b2fef521b8856382ba6bcb41f8ff5ce0011958a1a411409b315245c3749e99920ebcc4b8da8bba5ad
7
- data.tar.gz: f3983f25c5a3732f1b177ecef716d4f5abfc6f3bdbd9d3d1f5b9f3bf355768b74146179f6dd03332223eee70c908e14d78dd61e5c5118ddeb6d0976e19c76eec
6
+ metadata.gz: 1f939311cfd39356cf36eb832e955e1da0eeed5771f21a7239f716ac263dc2fd3674ad338f1cccc276b921fcc51c0228ce659656ac62a21fecb0ff102db412e6
7
+ data.tar.gz: e779a87718862563373b7e0ef87ff6bf941eeac2abbe5813e7038b03cfb332297ec4b2b38bd1cccc1de76098b347636dac39a46cce9431151aca12da76b2cc88
@@ -19,6 +19,8 @@ class Unidom::Visitor::Authenticating < Unidom::Visitor::ApplicationRecord
19
19
  scope :visitor_type_is, ->(visitor_type) { where visitor_type: visitor_type }
20
20
  scope :credential_type_is, ->(credential_type) { where credential_type: credential_type }
21
21
 
22
+ code :flag, Unidom::Visitor::Flag
23
+
22
24
  ##
23
25
  # 将访问者 visitor 和信任状 credential 关联起来。关联时间是 opened_at ,缺省是当前时间。如:
24
26
  # Unidom::Visitor::Authenticating.authenticate! user, with: password
@@ -26,6 +28,4 @@ class Unidom::Visitor::Authenticating < Unidom::Visitor::ApplicationRecord
26
28
  credential_is(with).visitor_is(visitor).valid_at.alive.first_or_create! opened_at: opened_at
27
29
  end
28
30
 
29
- code :flag, Unidom::Visitor::Flag
30
-
31
31
  end unless Unidom::Common::Neglection.namespace_neglected? 'Unidom::Visitor::Authenticating'
@@ -18,6 +18,8 @@ describe Unidom::Visitor::Authenticating, type: :model do
18
18
 
19
19
  it_behaves_like 'Unidom::Common::Concerns::ModelExtension', model_attributes
20
20
 
21
+ it_behaves_like 'ProgneTapera::EnumCode', described_class.new(model_attributes), :flag, Unidom::Visitor::Flag
22
+
21
23
  end
22
24
 
23
25
  end
@@ -13,8 +13,27 @@ 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
+
16
18
  it_behaves_like 'Unidom::Common::Concerns::ModelExtension', model_attributes
17
19
 
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
36
+
18
37
  end
19
38
 
20
39
  end
@@ -12,8 +12,39 @@ 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
+
15
18
  it_behaves_like 'Unidom::Common::Concerns::ModelExtension', model_attributes
16
19
 
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
36
+
37
+ it_behaves_like 'validates', model_attributes, :pepper_content,
38
+ { } => 0,
39
+ { pepper_content: nil } => 0,
40
+ { pepper_content: '' } => 2,
41
+ { pepper_content: '1'*(pepper_content_max_length-1) } => 1,
42
+ { pepper_content: 'A'*(pepper_content_max_length-1) } => 1,
43
+ { pepper_content: '1'*pepper_content_max_length } => 0,
44
+ { pepper_content: 'A'*pepper_content_max_length } => 0,
45
+ { pepper_content: '1'*(pepper_content_max_length+1) } => 1,
46
+ { pepper_content: 'A'*(pepper_content_max_length+1) } => 1
47
+
17
48
  end
18
49
 
19
50
  end
@@ -1,5 +1,5 @@
1
1
  module Unidom
2
2
  module Visitor
3
- VERSION = '1.13'.freeze
3
+ VERSION = '1.13.1'.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
+ version: 1.13.1
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-02-13 00:00:00.000000000 Z
11
+ date: 2017-02-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: unidom-common