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.0
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{(#{ActionController::Base.relative_url_root})?}
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
- ActionController::Base.relative_url_root = '/test'
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
@@ -1,4 +1,7 @@
1
1
  require 'rubygems'
2
+
3
+ ENV['RAILS_RELATIVE_URL_ROOT']='/appname'
4
+
2
5
  gem 'rails', '~>3'
3
6
  require 'active_support'
4
7
  require 'action_controller'
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: role_based_authorization
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.0
4
+ version: 0.3.1
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors: