roles_active_record 0.4.6.1 → 0.4.6.2
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.2
|
@@ -81,12 +81,19 @@ module Roles::ActiveRecord
|
|
81
81
|
end
|
82
82
|
|
83
83
|
def default_role_class strategy_name
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
84
|
+
require "roles_active_record/#{strategy_name}"
|
85
|
+
# if !defined? ::Role
|
86
|
+
# require "roles_active_record/#{strategy_name}"
|
87
|
+
# puts "Using default Role classes since they have not yet been defined" # if Roles::ActiveRecord.warnings_on
|
88
|
+
# return ::Role
|
89
|
+
# end
|
90
|
+
# if defined? ::Role
|
91
|
+
#
|
92
|
+
# puts "Role is defined"
|
93
|
+
# return ::Role
|
94
|
+
# end
|
95
|
+
# puts "Late binding!!!"
|
96
|
+
::Role
|
90
97
|
end
|
91
98
|
|
92
99
|
def get_role_class strategy_name, options
|
data/roles_active_record.gemspec
CHANGED
@@ -76,7 +76,7 @@ describe "Roles for Active Record: #{api_name}" do
|
|
76
76
|
it "should be true that the User class has a valid role of :guest" do
|
77
77
|
User.valid_roles?(:guest, :admin).should be_true
|
78
78
|
end
|
79
|
-
end
|
79
|
+
end
|
80
80
|
|
81
81
|
describe '#has_role?' do
|
82
82
|
it "should have admin user role to :admin and not to :user" do
|
@@ -176,7 +176,7 @@ describe "Roles for Active Record: #{api_name}" do
|
|
176
176
|
@guest_user.roles = :guest
|
177
177
|
end
|
178
178
|
end
|
179
|
-
|
179
|
+
|
180
180
|
describe '#role=' do
|
181
181
|
it "should set user role to :admin" do
|
182
182
|
@guest_user.role = :admin
|
@@ -191,7 +191,7 @@ describe "Roles for Active Record: #{api_name}" do
|
|
191
191
|
u.has_role?(:admin).should be_true
|
192
192
|
end
|
193
193
|
end
|
194
|
-
|
194
|
+
|
195
195
|
|
196
196
|
describe '#exchange_roles' do
|
197
197
|
it "should exchange user role :user with role :admin" do
|
@@ -225,5 +225,5 @@ describe "Roles for Active Record: #{api_name}" do
|
|
225
225
|
@guest_user.remove_role :admin
|
226
226
|
@guest_user.has_role?(:admin).should_not be_true
|
227
227
|
end
|
228
|
-
end
|
228
|
+
end
|
229
229
|
end
|