diff --git a/CHANGELOG.rdoc b/CHANGELOG.rdoc index fc6092d7..23e16601 100644 --- a/CHANGELOG.rdoc +++ b/CHANGELOG.rdoc @@ -1,3 +1,5 @@ +== 0.8.1 + * enhancements * Move salt to encryptors diff --git a/lib/devise/mapping.rb b/lib/devise/mapping.rb index 8c984e2c..d1fa14f8 100644 --- a/lib/devise/mapping.rb +++ b/lib/devise/mapping.rb @@ -92,9 +92,9 @@ module Devise self.path_prefix.count("/") end - # Returns the raw path using path_prefix and as. + # Returns the raw path using the current relative_url_root, path_prefix and as. def raw_path - path_prefix + as.to_s + ActionController::Base.relative_url_root.to_s + path_prefix + as.to_s end # Returns the parsed path. If you need meta information in your path_prefix, diff --git a/test/mapping_test.rb b/test/mapping_test.rb index 0bae4794..981af08a 100644 --- a/test/mapping_test.rb +++ b/test/mapping_test.rb @@ -86,7 +86,7 @@ class MappingTest < ActiveSupport::TestCase mapping = Devise.mappings[:manager] assert_equal '/:locale/', mapping.path_prefix end - + test 'retrieve as from the proper position' do assert_equal 1, Devise.mappings[:user].as_position assert_equal 2, Devise.mappings[:manager].as_position @@ -96,6 +96,18 @@ class MappingTest < ActiveSupport::TestCase assert_equal '/users', Devise.mappings[:user].raw_path assert_equal '/:locale/accounts', Devise.mappings[:manager].raw_path end + + test 'raw path adds in the relative_url_root' do + swap ActionController::Base, :relative_url_root => '/abc' do + assert_equal '/abc/users', Devise.mappings[:user].raw_path + end + end + + test 'raw path deals with a nil relative_url_root' do + swap ActionController::Base, :relative_url_root => nil do + assert_equal '/users', Devise.mappings[:user].raw_path + end + end test 'parsed path is returned' do begin @@ -106,7 +118,13 @@ class MappingTest < ActiveSupport::TestCase Devise.default_url_options {{ }} end end - + + test 'parsed path deals with non-standard relative_url_roots' do + swap ActionController::Base, :relative_url_root => "/abc" do + assert_equal '/abc/users', Devise.mappings[:user].parsed_path + end + end + test 'should have default route options' do assert_equal({}, Devise.mappings[:user].route_options) end