You can use ruby -n test_login_with_valid_user -rdebug filename.rb to
debug a test case. Before you would do that you could check
./log/test.log and perhaps avoid debugging altogether.
On 6/16/05, Mike Payson
<mikepayson-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
wrote:> I''m struggling to get through the testing chapter of the beta
book,
> and I keep running into the same general problem-- I''ve made an
error
> someplace, but the test failure message is so vague that I can''t
> figure out the source of the problem. Is there a general-purpose way
> to get the actual error message returned in addition to the
> test-failure message?
>
> In this particular case, my error is on the assert_not_nil here:
>
> def test_login_with_valid_user
> post :login, :user => {:name => "fred", :password =>
"abracadabra"}
> assert_redirected_to :action => "index"
> assert_not_nil(session[:user_id])
> user = User.find(session[:user_id])
> assert_equal ''fred'', user.name
> end
>
> I''m getting an error:
>
> test_login_with_valid_user(LoginControllerTest)
> [test/functional/login_controller_test.rb:31]:
> <nil> expected to not be nil.
>
> Clearly, my login is failing for some reason, so the session is not
> being created, but why? Without the error message, it''s hard to
tell.
> I know that I can return an error message, but where do I get that
> message from? I know this should be trivial, but I can''t seem to
find
> the right info.
> _______________________________________________
> Rails mailing list
> Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org
> http://lists.rubyonrails.org/mailman/listinfo/rails
>
--
http://deezsombor.blogspot.com