Forum: RSpec MockExpectationError with restful-authentication

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
Mark R. (Guest)
on 2008-12-31 20:56
(Received via mailing list)
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

9)
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:in
`send'
/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:in
`call_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:in
`perform_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:in
`perform_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:in
`cache'
/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:in
`perform_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:in
`process_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:in
`process_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:in
`process'
/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:in `do_create'
./spec/controllers/session_controller_spec.rb:55:
Pat M. (Guest)
on 2008-12-31 21:45
(Received via mailing list)
You didn't tell your mock object about the enabled? method. You need
to stub it out (prob set it to true)

Pat
Mark R. (Guest)
on 2009-01-01 21:42
(Received via mailing list)
Thanks that helped! Now I'm getting these errors...any ideas? Looks like
something cookie related?

http://pastie.org/350148
David C. (Guest)
on 2009-01-02 12:03
(Received via mailing list)
On Thu, Jan 1, 2009 at 1:40 PM, Mark A. Richman 
<removed_email_address@domain.invalid>
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
Mark R. (Guest)
on 2009-01-02 13:54
(Received via mailing list)
Thanks! That seems to have knocked out all but 4 errors. I'll keep
banging
away...this is fun! :)

Best,
Mark
This topic is locked and can not be replied to.