Try to fix the build for rails 3.1

This commit is contained in:
José Valim 2012-05-09 23:41:05 +02:00
parent 1698f0f57c
commit 454a5ad1ec
2 changed files with 10 additions and 6 deletions

View File

@ -88,7 +88,9 @@ module Devise
opts = {}
route = :"new_#{scope}_session_path"
opts[:format] = request_format unless skip_format?
opts[:script_name] = Rails.application.config.relative_url_root
config = Rails.application.config
opts[:script_name] = (config.relative_url_root if config.respond_to?(:relative_url_root))
context = send(Devise.available_router_name)

View File

@ -51,11 +51,13 @@ class FailureTest < ActiveSupport::TestCase
end
end
test 'returns to the default redirect location considering the relative url root' do
swap Rails.application.config, :relative_url_root => "/sample" do
call_failure
assert_equal 302, @response.first
assert_equal 'http://test.host/sample/users/sign_in', @response.second['Location']
if Rails.application.config.respond_to?(:relative_url_root)
test 'returns to the default redirect location considering the relative url root' do
swap Rails.application.config, :relative_url_root => "/sample" do
call_failure
assert_equal 302, @response.first
assert_equal 'http://test.host/sample/users/sign_in', @response.second['Location']
end
end
end