aegis 2.5.2 → 2.5.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/Gemfile +2 -2
- data/VERSION +1 -1
- data/aegis.gemspec +2 -2
- data/lib/aegis/spec/matchers.rb +33 -8
- metadata +4 -4
data/Gemfile
CHANGED
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
2.5.
|
1
|
+
2.5.3
|
data/aegis.gemspec
CHANGED
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{aegis}
|
8
|
-
s.version = "2.5.
|
8
|
+
s.version = "2.5.3"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Henning Koch", "Tobias Kraze"]
|
12
|
-
s.date = %q{2010-11-
|
12
|
+
s.date = %q{2010-11-10}
|
13
13
|
s.description = %q{Aegis is an authorization solution for Ruby on Rails that supports roles and a RESTish, resource-style declaration of permission rules.}
|
14
14
|
s.email = %q{henning.koch@makandra.de}
|
15
15
|
s.extra_rdoc_files = [
|
data/lib/aegis/spec/matchers.rb
CHANGED
@@ -44,15 +44,40 @@ module Aegis
|
|
44
44
|
CheckPermissions.new(*args)
|
45
45
|
end
|
46
46
|
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
47
|
+
class BeAllowedTo
|
48
|
+
|
49
|
+
def initialize(expected_action, *expected_args)
|
50
|
+
@expected_action = expected_action
|
51
|
+
@expected_args = expected_args
|
52
|
+
end
|
53
|
+
|
54
|
+
def matches?(user)
|
55
|
+
@actual_user = user
|
56
|
+
@actual_user.send("may_#{@expected_action}?", *@expected_args)
|
57
|
+
end
|
58
|
+
|
59
|
+
def description
|
60
|
+
"be allowed to #{action_as_prose}"
|
61
|
+
end
|
62
|
+
|
63
|
+
def failure_message
|
64
|
+
"expected #{@actual_user.inspect} to be allowed to #{action_as_prose}"
|
55
65
|
end
|
66
|
+
|
67
|
+
def negative_failure_message
|
68
|
+
"expected #{@actual_user.inspect} to be denied to #{action_as_prose}"
|
69
|
+
end
|
70
|
+
|
71
|
+
private
|
72
|
+
|
73
|
+
def action_as_prose
|
74
|
+
@expected_action.to_s + (@expected_args.present? ? " given #{@expected_args.inspect}" : "")
|
75
|
+
end
|
76
|
+
|
77
|
+
end
|
78
|
+
|
79
|
+
def be_allowed_to(*args)
|
80
|
+
BeAllowedTo.new(*args)
|
56
81
|
end
|
57
82
|
|
58
83
|
end
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: aegis
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 29
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 2
|
8
8
|
- 5
|
9
|
-
-
|
10
|
-
version: 2.5.
|
9
|
+
- 3
|
10
|
+
version: 2.5.3
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Henning Koch
|
@@ -16,7 +16,7 @@ autorequire:
|
|
16
16
|
bindir: bin
|
17
17
|
cert_chain: []
|
18
18
|
|
19
|
-
date: 2010-11-
|
19
|
+
date: 2010-11-10 00:00:00 +01:00
|
20
20
|
default_executable:
|
21
21
|
dependencies: []
|
22
22
|
|