From 9c5ff02ff15323056562e9a252fcc844e42280c0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Valim?= Date: Wed, 7 Jul 2010 21:32:13 +0200 Subject: [PATCH] Update CHANGELOG and tidy up tests. --- CHANGELOG.rdoc | 1 + test/failure_app_test.rb | 8 +++----- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/CHANGELOG.rdoc b/CHANGELOG.rdoc index 723f7997..6e35224b 100644 --- a/CHANGELOG.rdoc +++ b/CHANGELOG.rdoc @@ -4,6 +4,7 @@ * Rememberable module allows user to be remembered across browsers and is enabled by default (by github.com/trevorturk) * devise_for can now be used together with scope method in routes but with a few limitations (check the documentation) * Support :as or :devise_scope in the router to specify controller access scope + * HTTP Basic Auth can now be disabled/enabled for xhr(ajax) requests using http_authenticatable_on_xhr option. (by github.com/pellja) * bug fix * Fix a bug in Devise::TestHelpers where current_user was returning a Response object for non active accounts diff --git a/test/failure_app_test.rb b/test/failure_app_test.rb index b2b965f9..f263f58a 100644 --- a/test/failure_app_test.rb +++ b/test/failure_app_test.rb @@ -80,6 +80,8 @@ class FailureTest < ActiveSupport::TestCase test 'dont return WWW-authenticate on ajax call if http_authenticatable_on_xhr false' do swap Devise, :http_authenticatable_on_xhr => false do call_failure('formats' => :html, 'HTTP_X_REQUESTED_WITH' => 'XMLHttpRequest') + assert_equal 302, @response.first + assert_equal 'http://test.host/users/sign_in', @response.second["Location"] assert_nil @response.second['WWW-Authenticate'] end end @@ -87,6 +89,7 @@ class FailureTest < ActiveSupport::TestCase test 'return WWW-authenticate on ajax call if http_authenticatable_on_xhr true' do swap Devise, :http_authenticatable_on_xhr => true do call_failure('formats' => :html, 'HTTP_X_REQUESTED_WITH' => 'XMLHttpRequest') + assert_equal 401, @response.first assert_equal 'Basic realm="Application"', @response.second["WWW-Authenticate"] end end @@ -102,11 +105,6 @@ class FailureTest < ActiveSupport::TestCase assert_equal 401, @response.first end end - - test 'works for xml http requests' do - call_failure('formats' => :html, 'HTTP_X_REQUESTED_WITH' => 'XMLHttpRequest') - assert_equal 401, @response.first - end end context 'With recall' do