Restful-Authentication Rspec Failure Rails 2.0.2

I am trying the Restful-Authentication (latest version, downloaded
today) and upon running the generator, doing the migration, prepping
the test system and putting the resources in routes.rb I get a Rspec
test failure:

'SessionsController logins and redirects' FAILED
expected not nil, got nil

routes.rb has:
map.resources :users
map.resources :sessions

nothing else was changed or done. there is only one other controller/
model in the system and rspec tested it with no errors.

Is this a known bug? Should I just be using something else? I have
used this several times on 1.2.6 with no problem.

Thanks

Don French

Check your routes again.

You are showing:

routes.rb has:
map.resources :users
map.resources :sessions

It should be:
map.resources :users
map.resource :session

Note the singular form for session. Each user can only have one
session at a time so it's singular.

I tried that before and just did. Same error.

code around the failure is:
  it 'logins and redirects' do
    post :create, :login => 'quentin', :password => 'test'
    session[:user].should_not be_nil # -> Error is on this line
    response.should be_redirect
  end

Error is:
1)
'SessionsController logins and redirects' FAILED
expected not nil, got nil
/Users/dhf/NetBeansProjects/snrbad/spec/controllers/
sessions_controller_spec.rb:12:

Finished in 0.145385 seconds

9 examples, 1 failure

Changes in your app can cause these test failures. I very recently
used the rspec version when it was committed and had no problems.
It's only a restful_auth issue if it does this on a brand new app.
Please do send a patch if you uncover a bug.

It's only a restful_auth issue if it does this on a brand new app.

It does this to me on a brand new app.

Please do send a patch if you uncover a bug.

--- functional_spec.rb.orig 2007-12-31 17:33:13.000000000 -0500
+++ functional_spec.rb 2007-12-31 18:13:20.000000000 -0500
@@ -9,20 +9,20 @@

   it 'logins and redirects' do
     post :create, :login => 'quentin', :password => 'test'
- session[:<%= file_name %>].should_not be_nil
+ session[:<%= file_name %>_id].should_not be_nil
     response.should be_redirect
   end

   it 'fails login and does not redirect' do
     post :create, :login => 'quentin', :password => 'bad password'
- session[:<%= file_name %>].should be_nil
+ session[:<%= file_name %>_id].should be_nil
     response.should be_success
   end

   it 'logs out' do
     login_as :quentin
     get :destroy
- session[:<%= file_name %>].should be_nil
+ session[:<%= file_name %>_id].should be_nil
     response.should be_redirect
   end

Oh awesome, someone gets reprimanded for not testing before committing
:slight_smile: Thanks.

Thanks. I thought I had tried everything before I submitted the
problem. I even had done but did not mention what Rick had recommended
and it failed also.

When will then plugin be updated so I do not have to make the changes
on each project?

Don French