@response.body accumulating in functional tests?

I have two functional tests for my user controller:

def test_bad_registration
post :register, :email => “[email protected]
assert_response :success
assert_not_nil @response.body =~ /^<error/
assert_nil assigns[‘user’]
end

def test_good_registration
@response.body = nil
post :register, :username => “tester”,
:name => “Tester”,
:password => “test”,
:email => “[email protected]
assert_not_nil assigns[‘user’]
assert_response :success
breakpoint
puts “match: #{@response.body =~ /^<user/}”
puts “body: #{@response.body}”
end

I render xml from each like this “render :xml => …”.

The first test goes through but the second one shows both the output
of the first and second test in @response.body (below). It does not
happen when the first test is commented out.

Validation failed: Name can't be blank, Username can't be blank, Password can't be blank 31 Tester tester

Am I doing something wrong? Is there a better way to check rendered XML?

Thanks, Joel


http://wagerlabs.com/

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs