roles_active_record 0.4.6 → 0.4.6.1

Sign up to get free protection for your applications and to get access to all the features.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.4.6
1
+ 0.4.6.1
@@ -65,7 +65,7 @@ module ActiveRecord
65
65
  end
66
66
 
67
67
  def user_role_file
68
- role_class.as_filename
68
+ user_role_class.as_filename
69
69
  end
70
70
 
71
71
  def copy_role_models
@@ -79,12 +79,12 @@ module ActiveRecord
79
79
  end
80
80
 
81
81
  def copy_one_role_model
82
- logger.debug "copying role model for one_role strategy: #{role_file}"
82
+ logger.debug "generating role model for one_role strategy: #{role_file}"
83
83
  template 'one_role/role.rb', "app/models/#{role_file}.rb"
84
84
  end
85
85
 
86
86
  def copy_many_roles_models
87
- logger.debug "copying role models for many_roles strategy: #{role_file} and #{user_file}"
87
+ logger.debug "generating role models for many_roles strategy: #{role_file} and #{user_file}"
88
88
 
89
89
  template 'many_roles/role.rb', "app/models/#{role_file}.rb"
90
90
  template 'many_roles/user_role.rb', "app/models/#{user_role_file}.rb"
@@ -85,7 +85,8 @@ module Roles::ActiveRecord
85
85
  require "roles_active_record/#{strategy_name}"
86
86
  return ::Role
87
87
  end
88
- raise "Default Role class not defined" if Roles::ActiveRecord.warnings_on
88
+ puts "Default Role class not yet defined" if Roles::ActiveRecord.warnings_on
89
+ 'Role'
89
90
  end
90
91
 
91
92
  def get_role_class strategy_name, options
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{roles_active_record}
8
- s.version = "0.4.6"
8
+ s.version = "0.4.6.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{Makes it easy to set a role strategy on your User model in Active Record}
14
14
  s.email = %q{kmandrup@gmail.com}
15
15
  s.extra_rdoc_files = [
@@ -176,6 +176,22 @@ describe "Roles for Active Record: #{api_name}" do
176
176
  @guest_user.roles = :guest
177
177
  end
178
178
  end
179
+
180
+ describe '#role=' do
181
+ it "should set user role to :admin" do
182
+ @guest_user.role = :admin
183
+ @guest_user.has_role?(:admin).should be_true
184
+ @guest_user.has_role?(:guest).should be_false
185
+ @guest_user.role = :guest
186
+ @guest_user.has_role?(:guest).should be_true
187
+ @guest_user.has_role?(:admin).should be_false
188
+
189
+ u = User.new
190
+ u.role = :admin
191
+ u.has_role?(:admin).should be_true
192
+ end
193
+ end
194
+
179
195
 
180
196
  describe '#exchange_roles' do
181
197
  it "should exchange user role :user with role :admin" do
metadata CHANGED
@@ -6,7 +6,8 @@ version: !ruby/object:Gem::Version
6
6
  - 0
7
7
  - 4
8
8
  - 6
9
- version: 0.4.6
9
+ - 1
10
+ version: 0.4.6.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