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:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c4ae7ccc5485c17a50a314cce47f8151bbe39710
|
4
|
+
data.tar.gz: faec9876608008e19f4150f45a502b67b912544f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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 = {
|
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.
|
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-
|
11
|
+
date: 2017-04-10 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: unidom-common
|