Added a test to return empty json

This commit is contained in:
Rodrigo Flores
2011-06-21 18:44:38 -03:00
parent 8e3ab5921f
commit b37055fa47

View File

@@ -52,14 +52,14 @@ class PasswordTest < ActionController::IntegrationTest
assert_contain 'not found'
end
end
test 'reset password with email with extra whitespace should succeed when email is in the list of strip whitespace keys' do
create_user(:email => 'foo@bar.com')
request_forgot_password do
fill_in 'email', :with => ' foo@bar.com '
end
assert_current_url '/users/sign_in'
assert_contain 'You will receive an email with instructions about how to reset your password in a few minutes.'
end
@@ -67,11 +67,11 @@ class PasswordTest < ActionController::IntegrationTest
test 'reset password with email with extra whitespace should fail when email is NOT the list of strip whitespace keys' do
swap Devise, :strip_whitespace_keys => [] do
create_user(:email => 'foo@bar.com')
request_forgot_password do
fill_in 'email', :with => ' foo@bar.com '
end
assert_response :success
assert_current_url '/users/password'
assert_have_selector "input[type=email][value=' foo@bar.com ']"
@@ -187,7 +187,7 @@ class PasswordTest < ActionController::IntegrationTest
create_user
post user_password_path(:format => 'xml'), :user => {:email => "user@test.com"}
assert_response :success
assert response.body.include? %(<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<user>)
assert_equal response.body, { }.to_xml
end
test 'reset password request with invalid E-Mail in XML format should return valid response' do
@@ -245,4 +245,13 @@ class PasswordTest < ActionController::IntegrationTest
assert_current_url "/users/password"
end
end
test "when using json requests to ask a confirmable request, should not return the object" do
user = create_user(:confirm => false)
post user_password_path(:format => :json), :user => { :email => user.email }
assert_equal response.code, "201"
assert_equal response.body, "{}"
end
end