rolypoly 0.1.0 → 0.1.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -46,7 +46,7 @@ module Rolypoly
46
46
 
47
47
  def public?
48
48
  return true if rolypoly_gatekeepers.empty?
49
- current_gatekeepers.any &:public?
49
+ current_gatekeepers.any? &:public?
50
50
  end
51
51
 
52
52
  def current_gatekeepers
@@ -56,6 +56,10 @@ module Rolypoly
56
56
  all_actions? || !(check_actions & actions).empty?
57
57
  end
58
58
 
59
+ def public?
60
+ !!public
61
+ end
62
+
59
63
  protected # self.attr= gets mad
60
64
  attr_writer :roles
61
65
  attr_accessor :actions
@@ -78,6 +82,7 @@ module Rolypoly
78
82
  def sanitize_role_object(role_object)
79
83
  role_object.respond_to?(:to_role_string) ? role_object.to_role_string : role_object.to_s
80
84
  end
85
+ private :sanitize_role_object
81
86
 
82
87
  def can_set_with_to?
83
88
  roles.empty?
@@ -89,11 +94,6 @@ module Rolypoly
89
94
  end
90
95
  private :can_set_with_access_to?
91
96
 
92
- def public?
93
- !!public
94
- end
95
- private :public?
96
-
97
97
  def all_actions?
98
98
  !!all_actions
99
99
  end
@@ -1,3 +1,3 @@
1
1
  module Rolypoly
2
- VERSION = "0.1.0"
2
+ VERSION = "0.1.1"
3
3
  end
@@ -28,10 +28,16 @@ module Rolypoly
28
28
 
29
29
  describe "#index" do
30
30
  let(:action_name) { "index" }
31
+
32
+ it "is not public" do
33
+ controller_instance.should_not be_public
34
+ end
35
+
31
36
  it "allows admin access" do
32
37
  expect { controller_instance.rolypoly_check_role_access! }
33
38
  .not_to raise_error
34
39
  end
40
+
35
41
  it "can get current_roles from controller" do
36
42
  controller_instance.current_roles.should == [RoleObject.new(:admin)]
37
43
  end
@@ -43,6 +49,10 @@ module Rolypoly
43
49
  expect { controller_instance.rolypoly_check_role_access! }
44
50
  .to raise_error(Rolypoly::FailedRoleCheckError)
45
51
  end
52
+
53
+ it "is not public" do
54
+ controller_instance.should_not be_public
55
+ end
46
56
  end
47
57
 
48
58
  describe "#landing" do
@@ -58,6 +68,10 @@ module Rolypoly
58
68
  expect { controller_instance.rolypoly_check_role_access! }
59
69
  .not_to raise_error
60
70
  end
71
+
72
+ it "is public" do
73
+ controller_instance.should be_public
74
+ end
61
75
  end
62
76
  end
63
77
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rolypoly
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-10-24 00:00:00.000000000 Z
12
+ date: 2013-10-30 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: bundler
@@ -97,7 +97,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
97
97
  version: '0'
98
98
  segments:
99
99
  - 0
100
- hash: -3998777984339591811
100
+ hash: 4081264060094388096
101
101
  required_rubygems_version: !ruby/object:Gem::Requirement
102
102
  none: false
103
103
  requirements:
@@ -106,7 +106,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
106
106
  version: '0'
107
107
  segments:
108
108
  - 0
109
- hash: -3998777984339591811
109
+ hash: 4081264060094388096
110
110
  requirements: []
111
111
  rubyforge_project:
112
112
  rubygems_version: 1.8.25