roles_generic 0.3.7 → 0.3.7.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.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.3.7
1
+ 0.3.7.1
@@ -12,7 +12,11 @@ module Roles::Generic::Role
12
12
 
13
13
  def role_class class_constant
14
14
  const = class_constant.to_s.camelize
15
- @role_class_name = "#{const}".constantize
15
+ begin
16
+ @role_class_name = "#{const}".constantize
17
+ rescue
18
+ puts "Role class constant '#{const}' is not defined so it could not be set!"
19
+ end
16
20
  end
17
21
  end
18
22
  end
@@ -13,6 +13,18 @@ describe 'Roles Generic API : WRITE' do
13
13
  @guest_user.roles = :guest
14
14
  end
15
15
  end
16
+
17
+ describe '#role=' do
18
+ it "should set user role to :admin" do
19
+ @guest_user.role = :admin
20
+ @guest_user.has_role?(:admin).should be_true
21
+ @guest_user.role = :guest
22
+
23
+ u = User.new 'Test user'
24
+ u.role = :admin
25
+ u.has_role?(:admin).should be_true
26
+ end
27
+ end
16
28
 
17
29
  describe '#exchange_roles' do
18
30
  it "should exchange user role :user with role :admin" do
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{roles_generic}
8
- s.version = "0.3.7"
8
+ s.version = "0.3.7.1"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Kristian Mandrup"]
12
- s.date = %q{2011-01-10}
12
+ s.date = %q{2011-01-21}
13
13
  s.description = %q{Generic role strategies sharing the same API. Easy to insert in any model}
14
14
  s.email = %q{kmandrup@gmail.com}
15
15
  s.extra_rdoc_files = [
metadata CHANGED
@@ -6,7 +6,8 @@ version: !ruby/object:Gem::Version
6
6
  - 0
7
7
  - 3
8
8
  - 7
9
- version: 0.3.7
9
+ - 1
10
+ version: 0.3.7.1
10
11
  platform: ruby
11
12
  authors:
12
13
  - Kristian Mandrup
@@ -14,7 +15,7 @@ autorequire:
14
15
  bindir: bin
15
16
  cert_chain: []
16
17
 
17
- date: 2011-01-10 00:00:00 +01:00
18
+ date: 2011-01-21 00:00:00 +01:00
18
19
  default_executable:
19
20
  dependencies:
20
21
  - !ruby/object:Gem::Dependency