Permalink
Browse files

Try to fix the build for rails 3.1

  • Loading branch information...
1 parent 1698f0f commit 454a5ad1ec9ef0c2b089bb4229efb3e931666d5f @josevalim josevalim committed May 9, 2012
Showing with 10 additions and 6 deletions.
  1. +3 −1 lib/devise/failure_app.rb
  2. +7 −5 test/failure_app_test.rb
@@ -88,7 +88,9 @@ def scope_path
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
@@ -51,11 +51,13 @@ def call_failure(env_params={})
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

0 comments on commit 454a5ad

Please sign in to comment.