permiso 0.2.0 → 0.2.1

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.
@@ -1,3 +1,7 @@
1
+ v0.2.1 2011-08-17
2
+
3
+ * roles can be string or symbol
4
+
1
5
  v0.2.0 2011-08-17
2
6
 
3
7
  * add support for multiple roles
@@ -27,7 +27,7 @@ module Permiso
27
27
 
28
28
  def can?(user_roles, action, args={})
29
29
  user_roles = [user_roles] unless user_roles.kind_of? Array
30
- return false unless user_roles.detect {|r| role_can?(r, action) }
30
+ return false unless user_roles.detect {|r| role_can?(r.to_sym, action) }
31
31
  rule_allows?(action)
32
32
  end
33
33
 
@@ -1,3 +1,3 @@
1
1
  module Permiso
2
- VERSION = "0.2.0"
2
+ VERSION = "0.2.1"
3
3
  end
@@ -30,12 +30,16 @@ describe Permiso do
30
30
 
31
31
  it 'should allow, when role is defined' do
32
32
  ability = AbilityTest.new(@booking)
33
- p ability
34
33
  ability.can?(:admin, :cancel).should be_true
35
34
  ability.can?(:admin, :create).should be_true
36
35
  ability.can?(:user, :read).should be_true
37
36
  end
38
37
 
38
+ it 'should not make a difference whether role is string or symbol' do
39
+ ability = AbilityTest.new(@booking)
40
+ ability.can?('admin', :cancel).should be_true
41
+ end
42
+
39
43
  it 'should allow, when there are multiple roles and at least one is allowed' do
40
44
  ability = AbilityTest.new(@booking)
41
45
  ability.can?([:user, :admin], :read).should be_true
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: permiso
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.2.1
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors: