role_based_authorization 0.3.0 → 0.3.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.3.
|
1
|
+
0.3.1
|
@@ -33,7 +33,7 @@ module RoleBasedAuthorization
|
|
33
33
|
# Returns an hash options amenable to be passed to authorize_action?. It takes either
|
34
34
|
# an option hash, or a path string
|
35
35
|
def RoleBasedAuthorization.path_or_options_to_options(opts)
|
36
|
-
path_cleanup_regexp = %r{(#{
|
36
|
+
path_cleanup_regexp = %r{(#{ENV['RAILS_RELATIVE_URL_ROOT']})?}
|
37
37
|
|
38
38
|
url_options = (opts.class <= String) && Rails.application.routes.recognize_path(opts.gsub(path_cleanup_regexp,''))
|
39
39
|
url_options ||= opts.dup
|
@@ -154,7 +154,7 @@ class RoleBasedAuthorizationTest < ActiveSupport::TestCase
|
|
154
154
|
end
|
155
155
|
|
156
156
|
test "path_or_options_to_options should work also when paths contain the relative_url_root" do
|
157
|
-
|
157
|
+
ENV['RAILS_RELATIVE_URL_ROOT'] = '/test'
|
158
158
|
options = RoleBasedAuthorization.path_or_options_to_options('/test/dummy/very_low_security')
|
159
159
|
assert_equal 'dummy', options[:controller]
|
160
160
|
assert_equal 'very_low_security', options[:action]
|
data/test/test_helper.rb
CHANGED