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: 31db490fd3a2fd39b290aa7c5f9368e1ce3fa963
4
- data.tar.gz: eef7f29cd0632c9066686d00b873629ef80f7942
3
+ metadata.gz: 2c6531f19ef8b5dbc0b493ec8e152e9b437a30cb
4
+ data.tar.gz: e697f17d7fd567a6267dacd4920818f7fc38479d
5
5
  SHA512:
6
- metadata.gz: 6719cd08a3549f2b23a5193e86e656fb88480d3321193fad86709e09fdfe9ccf07b68659a5c51efe2b59e6c27904227246b23d17ece00882b411262123d9f881
7
- data.tar.gz: 71ae69d703a4c4502ddc000f06294c6c87f047253c2c4a86b7acee3a6d3d0106abf4b9e4578bfe8320e109afbdd1f77caf99a16ecb237f1b1b604204f1087da3
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 `#{name}' is not allowed")
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}")
@@ -3,6 +3,6 @@ module Surrounded
3
3
  module Context
4
4
  class InvalidRole < ::Triad::KeyNotPresent; end
5
5
  module InvalidRoleType; end
6
- class AccessError < StandardError; end
6
+ class AccessError < ::StandardError; end
7
7
  end
8
8
  end
@@ -1,3 +1,3 @@
1
1
  module Surrounded
2
- VERSION = "0.7.0"
2
+ VERSION = "0.7.1"
3
3
  end
@@ -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 `if_ready' is not allowed/i, error.message)
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){ CastingUser.new("Jim") }
136
- let(:other_user){ User.new("Guille") }
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.user_ancestors, RoleAssignmentContext::User)
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.other_user_ancestors, RoleAssignmentContext::OtherUser)
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.0
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-20 00:00:00.000000000 Z
11
+ date: 2014-01-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: triad