dmrolfs (1) [Avatar] Offline
#1
When I check the tests in Section 3.7, the restful_authentication code seems to fail the functional tests on the SessionsControllerTest.test_should_login_and_redirect() operation. Specifically it fails on assert session[:user_id].

The version of restful_authentication installed (following the book) is 3183.

It's not blocking me yet, but would appreciate ideas to get the tests completely passing.

Thanks!

rake output:

dmr$ rake
(in /Users/dmr/flexiblerails/current/pomodo)
/opt/local/bin/ruby -Ilib:test "/opt/local/lib/ruby/gems/1.8/gems/rake-0.8.1/lib/rake/rake_test_loader.rb" "test/unit/user_test.rb"
Loaded suite /opt/local/lib/ruby/gems/1.8/gems/rake-0.8.1/lib/rake/rake_test_loader
Started
.............
Finished in 0.666378 seconds.

13 tests, 26 assertions, 0 failures, 0 errors
/opt/local/bin/ruby -Ilib:test "/opt/local/lib/ruby/gems/1.8/gems/rake-0.8.1/lib/rake/rake_test_loader.rb" "test/functional/sessions_controller_test.rb" "test/functional/users_controller_test.rb"
Loaded suite /opt/local/lib/ruby/gems/1.8/gems/rake-0.8.1/lib/rake/rake_test_loader
Started
....F.........
Finished in 0.388504 seconds.

1) Failure:
test_should_login_and_redirect(SessionsControllerTest)
[./test/functional/sessions_controller_test.rb:18:in `test_should_login_and_redirect'
/Users/dmr/flexiblerails/current/pomodo/vendor/rails/activerecord/lib/../../activesupport/lib/active_support/testing/setup_and_teardown.rb:60:in `__send__'
/Users/dmr/flexiblerails/current/pomodo/vendor/rails/activerecord/lib/../../activesupport/lib/active_support/testing/setup_and_teardown.rb:60:in `run']:
<nil> is not true.

14 tests, 25 assertions, 1 failures, 0 errors
/opt/local/bin/ruby -Ilib:test "/opt/local/lib/ruby/gems/1.8/gems/rake-0.8.1/lib/rake/rake_test_loader.rb"
Errors running test:functionals!
beemsoft (2) [Avatar] Offline
#2
Re: Iteration 3: restful_authentication fails rake functional test
My tests for iteration 3 have passed successfully.
In the sessions_controller_test, I have "assert session[:user]" instead of "assert session[:user_id]".

However, my tests for iteration 5 had the same failure as you have.
I've fixed that by changing "assert session[:user]" to "assert session[:user_id]".