MockExpectationError with restful-authentication

Hi there…this is my first time using rspec and rspec-rails. When I run
rake spec, I get this type of error over and over…what does it mean,
and
how can I correct it?

Thanks,
Mark

Spec::Mocks::MockExpectationError in ‘SessionController on successful
login,
my request cookie token is valid, and ask not to be remembered sets an
auth
cookie’
Mock ‘User_1’ received unexpected message :enabled? with (no args)
/Users/mark/rails_apps/ExamRoom/app/controllers/session_controller.rb:14:in
create' /Library/Ruby/Gems/1.8/gems/actionpack-2.2.2/lib/action_controller/base.rb:1253:insend’
/Library/Ruby/Gems/1.8/gems/actionpack-2.2.2/lib/action_controller/base.rb:1253:in
perform_action_without_filters' /Library/Ruby/Gems/1.8/gems/actionpack-2.2.2/lib/action_controller/filters.rb:617:incall_filters’
/Library/Ruby/Gems/1.8/gems/actionpack-2.2.2/lib/action_controller/filters.rb:610:in
perform_action_without_benchmark' /Library/Ruby/Gems/1.8/gems/actionpack-2.2.2/lib/action_controller/benchmarking.rb:68:inperform_action_without_rescue’
/Library/Ruby/Gems/1.8/gems/actionpack-2.2.2/lib/action_controller/benchmarking.rb:68:in
perform_action_without_rescue' /Library/Ruby/Gems/1.8/gems/actionpack-2.2.2/lib/action_controller/rescue.rb:136:inperform_action_without_caching’
/Library/Ruby/Gems/1.8/gems/actionpack-2.2.2/lib/action_controller/caching/sql_cache.rb:13:in
perform_action' /Library/Ruby/Gems/1.8/gems/activerecord-2.2.2/lib/active_record/connection_adapters/abstract/query_cache.rb:34:incache’
/Library/Ruby/Gems/1.8/gems/activerecord-2.2.2/lib/active_record/query_cache.rb:8:in
cache' /Library/Ruby/Gems/1.8/gems/actionpack-2.2.2/lib/action_controller/caching/sql_cache.rb:12:inperform_action’
/Library/Ruby/Gems/1.8/gems/actionpack-2.2.2/lib/action_controller/base.rb:524:in
send' /Library/Ruby/Gems/1.8/gems/actionpack-2.2.2/lib/action_controller/base.rb:524:inprocess_without_filters’
/Library/Ruby/Gems/1.8/gems/actionpack-2.2.2/lib/action_controller/filters.rb:606:in
process_without_session_management_support' /Library/Ruby/Gems/1.8/gems/actionpack-2.2.2/lib/action_controller/session_management.rb:134:inprocess_without_test’
/Library/Ruby/Gems/1.8/gems/actionpack-2.2.2/lib/action_controller/test_process.rb:18:in
process' /Library/Ruby/Gems/1.8/gems/actionpack-2.2.2/lib/action_controller/test_process.rb:407:inprocess’
/Library/Ruby/Gems/1.8/gems/actionpack-2.2.2/lib/action_controller/test_process.rb:376:in
post' ./spec/controllers/session_controller_spec.rb:15:indo_create’
./spec/controllers/session_controller_spec.rb:55:

You didn’t tell your mock object about the enabled? method. You need
to stub it out (prob set it to true)

Pat

Thanks that helped! Now I’m getting these errors…any ideas? Looks like
something cookie related?

http://pastie.org/350148

On Thu, Jan 1, 2009 at 1:40 PM, Mark A. Richman [email protected]
wrote:

Thanks that helped! Now I’m getting these errors…any ideas? Looks like
something cookie related?

http://pastie.org/350148

Only the first 2 look cookie related to me. The rest seem like typos -
either things that you changed after generating the restful auth
material (like redirecting to “/dashboard” instead of “/”) or perhaps
there are typos in the generated specs (“session” vs “sessions”).

In most of these cases, you should be able to see from the failure
messages what the discrepancies are and you just need to choose
whether the specs are correct or the code is correct and adjust
appropriately.

HTH,
David

Thanks! That seems to have knocked out all but 4 errors. I’ll keep
banging
away…this is fun! :slight_smile:

Best,
Mark

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