rolify 0.5.0 → 0.5.1

Sign up to get free protection for your applications and to get access to all the features.
data/CHANGELOG.rdoc CHANGED
@@ -1,3 +1,6 @@
1
+ = 0.5.1
2
+ * fixed a nasty typo on a variable name and added a spec to make this never happen again
3
+
1
4
  = 0.5
2
5
  * dynamic shortcuts support
3
6
  * creates automatically new methods upon new role creation (or at startup for a Rails app)
data/lib/rolify/role.rb CHANGED
@@ -87,7 +87,7 @@ module Rolify
87
87
  def define_dynamic_method(role_name, resource)
88
88
  class_eval do
89
89
  define_method("is_#{role_name}?".to_sym) do
90
- has_role?("#{role_.name}")
90
+ has_role?("#{role_name}")
91
91
  end if !method_defined? "is_#{role_name}?".to_sym
92
92
 
93
93
  define_method("is_#{role_name}_of?".to_sym) do |arg|
@@ -1,3 +1,3 @@
1
1
  module Rolify
2
- VERSION = "0.5.0"
2
+ VERSION = "0.5.1"
3
3
  end
@@ -66,6 +66,10 @@ describe Rolify do
66
66
  it "should get a global role" do
67
67
  @admin.has_role?("admin").should be(true)
68
68
  end
69
+
70
+ it "should be able to use dynamic shortcut" do
71
+ @admin.is_admin?.should be(true)
72
+ end
69
73
 
70
74
  it "should get any resource request" do
71
75
  @admin.has_role?("admin", Forum.first).should be(true)
@@ -138,7 +142,13 @@ describe Rolify do
138
142
  it "should get a scoped role" do
139
143
  @moderator.has_role?("moderator", Forum.first).should be(true)
140
144
  end
141
-
145
+
146
+ it "should be able to use dynamic shortcut" do
147
+ @moderator.is_moderator?.should be(false)
148
+ @moderator.is_moderator_of?(Forum.first).should be(true)
149
+ @moderator.is_moderator_of?(Forum.last).should be(false)
150
+ end
151
+
142
152
  it "should not get a global role" do
143
153
  @moderator.has_role?("admin").should be(false)
144
154
  end
metadata CHANGED
@@ -2,7 +2,7 @@
2
2
  name: rolify
3
3
  version: !ruby/object:Gem::Version
4
4
  prerelease:
5
- version: 0.5.0
5
+ version: 0.5.1
6
6
  platform: ruby
7
7
  authors:
8
8
  - Florent Monbillard