surrounded 0.7.0 → 0.7.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:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2c6531f19ef8b5dbc0b493ec8e152e9b437a30cb
|
4
|
+
data.tar.gz: e697f17d7fd567a6267dacd4920818f7fc38479d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 45331f12b9e8bede773e36f022f1df5950de459b6687b5dad81b960d2cf4d85fbd694b79d4cc94691871dfdae699a0bbe19a54537f544c98e21afd29f20f2e60
|
7
|
+
data.tar.gz: 0adab8408e419a3437a75bf08f342a15aaef6b6b9090bd1bb3352a09e44eeeebe4bbf6abe638cd4601dcce85daf10180a088e336e0b94e3f021f7de2090aab9b
|
@@ -2,6 +2,7 @@ module Surrounded
|
|
2
2
|
module AccessControl
|
3
3
|
def self.extended(base)
|
4
4
|
base.send(:include, AccessMethods)
|
5
|
+
base.const_set(:'AccessError', Class.new(StandardError))
|
5
6
|
end
|
6
7
|
|
7
8
|
private
|
@@ -20,7 +21,7 @@ module Surrounded
|
|
20
21
|
|
21
22
|
method_restrictor = "disallow_#{name}?"
|
22
23
|
if self.respond_to?(method_restrictor, true) && self.send(method_restrictor)
|
23
|
-
raise ::Surrounded::Context::AccessError.new("access to
|
24
|
+
raise ::Surrounded::Context::AccessError.new("access to #{self.name}##{name} is not allowed")
|
24
25
|
end
|
25
26
|
|
26
27
|
self.send("__trigger_#{name}")
|
data/lib/surrounded/version.rb
CHANGED
data/test/context_access_test.rb
CHANGED
@@ -32,9 +32,9 @@ describe Surrounded::Context, 'access control' do
|
|
32
32
|
end
|
33
33
|
|
34
34
|
it 'raises errors when trigger method not allowed' do
|
35
|
-
error = assert_raises(Surrounded::Context::AccessError){
|
35
|
+
error = assert_raises(::Surrounded::Context::AccessError){
|
36
36
|
context.if_ready
|
37
37
|
}
|
38
|
-
assert_match(/access to
|
38
|
+
assert_match(/access to FilteredContext#if_ready is not allowed/i, error.message)
|
39
39
|
end
|
40
40
|
end
|
@@ -132,16 +132,16 @@ end
|
|
132
132
|
|
133
133
|
describe Surrounded::Context, 'assigning roles' do
|
134
134
|
include Surrounded
|
135
|
-
let(:user){
|
136
|
-
let(:other_user){
|
135
|
+
let(:user){ User.new("Jim") }
|
136
|
+
let(:other_user){ CastingUser.new("Guille") }
|
137
137
|
let(:context){ RoleAssignmentContext.new(user, other_user) }
|
138
138
|
|
139
139
|
it 'tries to use casting to add roles' do
|
140
|
-
refute_includes(context.
|
140
|
+
refute_includes(context.other_user_ancestors, RoleAssignmentContext::OtherUser)
|
141
141
|
end
|
142
142
|
|
143
143
|
it 'extends objects with role modules failing casting' do
|
144
|
-
assert_includes(context.
|
144
|
+
assert_includes(context.user_ancestors, RoleAssignmentContext::User)
|
145
145
|
end
|
146
146
|
|
147
147
|
it 'sets role players to respond to role methods' do
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: surrounded
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.7.
|
4
|
+
version: 0.7.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- '''Jim Gay'''
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-01-
|
11
|
+
date: 2014-01-22 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: triad
|