perm 0.0.2 → 0.0.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/perm/version.rb +1 -1
- data/test/authorizer_test.rb +18 -3
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 939b74007f4554f28e417a3bb90126d717b338cb
|
4
|
+
data.tar.gz: de861cba01bbe5c5d56b88966ec6a71493e506e2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: fb4b3b0598e6516c95272a4d40c819f34a2a8fa698ec208a26d9d27cb125ee78e1a8dcedd972c556ff8d7e798f6903b864d9e0ed69ea94959b86a2cdded8f118
|
7
|
+
data.tar.gz: 1dec4acfade13ebb62e1c87ef4b47e17c548c28ab4d97943890ae2abc74e8a88a67bcf04a37dcff9186b5990647b84dd5b3bcd1f41c7cb336f3752677feee84f
|
data/lib/perm/version.rb
CHANGED
data/test/authorizer_test.rb
CHANGED
@@ -41,9 +41,9 @@ module Perm
|
|
41
41
|
end
|
42
42
|
|
43
43
|
before do
|
44
|
-
|
45
|
-
|
46
|
-
@mary = PostAuthorizer.new(
|
44
|
+
@umary = User.new
|
45
|
+
@umary.roles = [:admin]
|
46
|
+
@mary = PostAuthorizer.new(@umary)
|
47
47
|
|
48
48
|
john = User.new
|
49
49
|
john.roles = [:editor, :writer]
|
@@ -58,6 +58,21 @@ module Perm
|
|
58
58
|
@post = Post.new
|
59
59
|
@post.title = "Authorization made easy"
|
60
60
|
@post.user = beth
|
61
|
+
beth.posts << @post
|
62
|
+
end
|
63
|
+
|
64
|
+
test "authorizers respond to all can_*? methods" do
|
65
|
+
assert @mary.respond_to?(:can_perform_magic?)
|
66
|
+
assert !@mary.can_perform_magic?
|
67
|
+
assert !@mary.respond_to?(:can_do_anything)
|
68
|
+
end
|
69
|
+
|
70
|
+
test "authorizers expose the wrapped user" do
|
71
|
+
assert @mary.user == @umary
|
72
|
+
end
|
73
|
+
|
74
|
+
test "authorizers forward non-can_*? messages to wrapped object" do
|
75
|
+
assert @mary.posts.is_a?(Array)
|
61
76
|
end
|
62
77
|
|
63
78
|
test "mary can read" do
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: perm
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Nathan Hopkins
|
@@ -11,13 +11,13 @@ cert_chain: []
|
|
11
11
|
date: 2014-11-09 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
|
-
name:
|
14
|
+
name: rake
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
17
|
- - ">="
|
18
18
|
- !ruby/object:Gem::Version
|
19
19
|
version: '0'
|
20
|
-
type: :
|
20
|
+
type: :development
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
@@ -25,7 +25,7 @@ dependencies:
|
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: '0'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
|
-
name:
|
28
|
+
name: roleup
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
31
|
- - ">="
|