test/integration/authenticatable_test.rb in devise-1.4.9 vs test/integration/authenticatable_test.rb in devise-1.5.0.rc1
- old
+ new
@@ -129,21 +129,21 @@
assert_raises ActionController::RoutingError do
get dashboard_path
end
end
- test 'signed in user should not see join page' do
+ test 'signed in user should not see unauthenticated page' do
sign_in_as_user
assert warden.authenticated?(:user)
assert_not warden.authenticated?(:admin)
assert_raises ActionController::RoutingError do
get join_path
end
end
- test 'not signed in should see join page' do
+ test 'not signed in users should see unautheticated page' do
get join_path
assert_response :success
assert_template 'home/join'
assert_contain 'Join'
@@ -198,10 +198,16 @@
assert_redirected_to root_path
get root_path
assert_not_contain 'Signed out successfully'
end
+
+ test 'scope uses custom failure app' do
+ put "/en/accounts/management"
+ assert_equal "Oops, not found", response.body
+ assert_equal 404, response.status
+ end
end
class AuthenticationRedirectTest < ActionController::IntegrationTest
test 'redirect from warden shows sign in or sign up message' do
get admins_path
@@ -310,11 +316,11 @@
sign_in_as_user
assert_not_equal session_id, request.session["session_id"]
end
end
-class AuthenticationWithScopesTest < ActionController::IntegrationTest
+class AuthenticationWithScopedViewsTest < ActionController::IntegrationTest
test 'renders the scoped view if turned on and view is available' do
swap Devise, :scoped_views => true do
assert_raise Webrat::NotFoundError do
sign_in_as_user
end
@@ -432,9 +438,25 @@
assert_not warden.authenticated?(:admin)
end
test 'sign in with xml format returns xml response' do
create_user
+ post user_session_path(:format => 'xml'), :user => {:email => "user@test.com", :password => '123456'}
+ assert_response :success
+ assert response.body.include? %(<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<user>)
+ end
+
+ test 'sign in with xml format is idempotent' do
+ get new_user_session_path(:format => 'xml')
+ assert_response :success
+
+ create_user
+ post user_session_path(:format => 'xml'), :user => {:email => "user@test.com", :password => '123456'}
+ assert_response :success
+
+ get new_user_session_path(:format => 'xml')
+ assert_response :success
+
post user_session_path(:format => 'xml'), :user => {:email => "user@test.com", :password => '123456'}
assert_response :success
assert response.body.include? %(<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<user>)
end