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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: d5374535f076e9f2f48a6d5f83e2a601afda7f79
4
- data.tar.gz: 283b6018f0690aa50362e37d763dac8e25c7877b
3
+ metadata.gz: 939b74007f4554f28e417a3bb90126d717b338cb
4
+ data.tar.gz: de861cba01bbe5c5d56b88966ec6a71493e506e2
5
5
  SHA512:
6
- metadata.gz: 45345d4954fe9cd46cbf84ecb0b5fcb38787780248465a4f1a390673fdde4af7def2c6c20fc9c5de0b32f7ad6fd09cea6bf83d8c10836f1160c0112b04d4d3d1
7
- data.tar.gz: f9c7cf0b73028c0c7dbec87e0b5e55eab69bb08a9b568e5335d5423785a8bbd5d159d5699be0211ec8f0280dffc93c5f0891e695c5eb7f7a10228446660c9737
6
+ metadata.gz: fb4b3b0598e6516c95272a4d40c819f34a2a8fa698ec208a26d9d27cb125ee78e1a8dcedd972c556ff8d7e798f6903b864d9e0ed69ea94959b86a2cdded8f118
7
+ data.tar.gz: 1dec4acfade13ebb62e1c87ef4b47e17c548c28ab4d97943890ae2abc74e8a88a67bcf04a37dcff9186b5990647b84dd5b3bcd1f41c7cb336f3752677feee84f
data/lib/perm/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Perm
2
- VERSION = "0.0.2"
2
+ VERSION = "0.0.3"
3
3
  end
@@ -41,9 +41,9 @@ module Perm
41
41
  end
42
42
 
43
43
  before do
44
- mary = User.new
45
- mary.roles = [:admin]
46
- @mary = PostAuthorizer.new(mary)
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.2
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: roleup
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: :runtime
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: rake
28
+ name: roleup
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
31
  - - ">="