unidom-authorization 1.6.6 → 1.6.7

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: 47b951ac579a7447bedceda83c0963c990e5d3cd
4
- data.tar.gz: d4f26614fbb5eeb7cbd88c9ca24a3c99ca2dbea9
3
+ metadata.gz: c4ae7ccc5485c17a50a314cce47f8151bbe39710
4
+ data.tar.gz: faec9876608008e19f4150f45a502b67b912544f
5
5
  SHA512:
6
- metadata.gz: d594bfc5375eac418e8be9135e63f8bf26872f9e87f485ebe52142ef60829d0f33bd9fb091e72a86af5ca459a87b916700f04f395bdd433a850b07d3946988fc
7
- data.tar.gz: 077d878af12750832c752e3ea4d9e50a6822cae74c33f5ceaa68b202dc3f4c450f204e3b90a28e49f3f12fdf3daf7bc21bc60ae74bccf8562112602aca905cf3
6
+ metadata.gz: ae90a1ce3ac29cdde27994758081beddd9047ebff4465ef92137cf5b513cc8c0ec92f020fac5c26e01ef3ff62dfd16498aee7ecdcd6316ff16308911b14b9800
7
+ data.tar.gz: 7ce92fd4a31dc53da01550c3666e6a209238244f78ca7c938ed17884b06fe921d5d67fb6c17aaf4aed859508437a109233617d17a856efd736152df299f79f70
@@ -1,5 +1,46 @@
1
1
  shared_examples 'Unidom::Authorization::Concerns::AsAuthorized' do |model_attributes, permission, authorizer|
2
2
 
3
+ before :each do
4
+ @authorized = described_class.create! model_attributes
5
+ end
6
+
7
+ after :each do
8
+ end
9
+
10
+ context '#is_authorized!' do
11
+
12
+ it "should be able to be authorized by #{authorizer.inspect}" do
13
+ authorizing = @authorized.is_authorized! permission: permission, by: authorizer
14
+ expect(authorizing).to be_present
15
+ expect(authorizing).to be_a(Unidom::Authorization::Authorizing)
16
+ expect(authorizing).not_to be_new_record
17
+ end
18
+
19
+ it "should be able to be authorized by #{authorizer.inspect}, at #{Time.now.inspect}" do
20
+ authorizing = @authorized.is_authorized! permission: permission, by: authorizer, at: Time.now
21
+ expect(authorizing).to be_present
22
+ expect(authorizing).to be_a(Unidom::Authorization::Authorizing)
23
+ expect(authorizing).not_to be_new_record
24
+ end
25
+
26
+ end
27
+
28
+ context '#is_authorized?' do
29
+
30
+ it "should be able to be authorized by #{authorizer.inspect}" do
31
+ expect(@authorized.is_authorized? permission: permission).to be_falsey
32
+ @authorized.is_authorized! permission: permission, by: authorizer
33
+ expect(@authorized.is_authorized? permission: permission).to be_truthy
34
+ end
35
+
36
+ it "should be able to be authorized by #{authorizer.inspect}, at #{Time.now.inspect}" do
37
+ expect(@authorized.is_authorized? permission: permission, at: Time.now).to be_falsey
38
+ @authorized.is_authorized! permission: permission, by: authorizer, at: Time.now
39
+ expect(@authorized.is_authorized? permission: permission, at: Time.now).to be_truthy
40
+ end
41
+
42
+ end
43
+
3
44
  context do
4
45
 
5
46
  authorizing_1_attribtues = {
@@ -1,5 +1,46 @@
1
1
  shared_examples 'Unidom::Authorization::Concerns::AsPermission' do |model_attributes, authorized, authorizer|
2
2
 
3
+ before :each do
4
+ @permission = described_class.create! model_attributes
5
+ end
6
+
7
+ after :each do
8
+ end
9
+
10
+ context '#authorize!' do
11
+
12
+ it "should be able to authorize #{authorized.inspect} by #{authorizer.inspect}" do
13
+ authorizing = @permission.authorize! authorized, by: authorizer
14
+ expect(authorizing).to be_present
15
+ expect(authorizing).to be_a(Unidom::Authorization::Authorizing)
16
+ expect(authorizing).not_to be_new_record
17
+ end
18
+
19
+ it "should be able to authorize #{authorized.inspect} by #{authorizer.inspect}, at #{Time.now.inspect}" do
20
+ authorizing = @permission.authorize! authorized, by: authorizer, at: Time.now
21
+ expect(authorizing).to be_present
22
+ expect(authorizing).to be_a(Unidom::Authorization::Authorizing)
23
+ expect(authorizing).not_to be_new_record
24
+ end
25
+
26
+ end
27
+
28
+ context '#authorize?' do
29
+
30
+ it "should be able to authorize #{authorized.inspect} by #{authorizer.inspect}" do
31
+ expect(@permission.authorize? authorized).to be_falsey
32
+ @permission.authorize! authorized, by: authorizer
33
+ expect(@permission.authorize? authorized).to be_truthy
34
+ end
35
+
36
+ it "should be able to authorize #{authorized.inspect} by #{authorizer.inspect}, at #{Time.now.inspect}" do
37
+ expect(@permission.authorize? authorized, at: Time.now).to be_falsey
38
+ @permission.authorize! authorized, by: authorizer, at: Time.now
39
+ expect(@permission.authorize? authorized, at: Time.now).to be_truthy
40
+ end
41
+
42
+ end
43
+
3
44
  context do
4
45
 
5
46
  authorizing_1_attribtues = {
@@ -1,5 +1,5 @@
1
1
  module Unidom
2
2
  module Authorization
3
- VERSION = '1.6.6'.freeze
3
+ VERSION = '1.6.7'.freeze
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: unidom-authorization
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.6.6
4
+ version: 1.6.7
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-03 00:00:00.000000000 Z
11
+ date: 2017-04-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: unidom-common