[rspec-users] MockExpectationError with restful-authentication

Pat Maddox pergesu at gmail.com
Wed Dec 31 14:43:41 EST 2008


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

Pat


On 12/31/08, Mark A. Richman <mark at markrichman.com> wrote:
> 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:
>


More information about the rspec-users mailing list