Mark A. Richman
2008-Dec-31 18:54 UTC
[rspec-users] 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 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: -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://rubyforge.org/pipermail/rspec-users/attachments/20081231/ed05f351/attachment.html>
Pat Maddox
2008-Dec-31 19:43 UTC
[rspec-users] MockExpectationError with restful-authentication
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: >
Mark A. Richman
2009-Jan-01 19:40 UTC
[rspec-users] MockExpectationError with restful-authentication
Thanks that helped! Now I''m getting these errors...any ideas? Looks like something cookie related? http://pastie.org/350148 On Wed, Dec 31, 2008 at 2:43 PM, Pat Maddox <pergesu at gmail.com> wrote:> 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: > > > _______________________________________________ > rspec-users mailing list > rspec-users at rubyforge.org > http://rubyforge.org/mailman/listinfo/rspec-users >-------------- next part -------------- An HTML attachment was scrubbed... URL: <http://rubyforge.org/pipermail/rspec-users/attachments/20090101/d62a1564/attachment.html>
David Chelimsky
2009-Jan-02 10:00 UTC
[rspec-users] MockExpectationError with restful-authentication
On Thu, Jan 1, 2009 at 1:40 PM, Mark A. Richman <mark at markrichman.com> wrote:> Thanks that helped! Now I''m getting these errors...any ideas? Looks like > something cookie related? > > http://pastie.org/350148Only 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> > On Wed, Dec 31, 2008 at 2:43 PM, Pat Maddox <pergesu at gmail.com> wrote: >> >> 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: >> > >> _______________________________________________ >> rspec-users mailing list >> rspec-users at rubyforge.org >> http://rubyforge.org/mailman/listinfo/rspec-users > > > _______________________________________________ > rspec-users mailing list > rspec-users at rubyforge.org > http://rubyforge.org/mailman/listinfo/rspec-users >
Mark A. Richman
2009-Jan-02 11:52 UTC
[rspec-users] MockExpectationError with restful-authentication
Thanks! That seems to have knocked out all but 4 errors. I''ll keep banging away...this is fun! :) Best, Mark On Fri, Jan 2, 2009 at 5:00 AM, David Chelimsky <dchelimsky at gmail.com>wrote:> On Thu, Jan 1, 2009 at 1:40 PM, Mark A. Richman <mark at markrichman.com> > 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 > > > > > On Wed, Dec 31, 2008 at 2:43 PM, Pat Maddox <pergesu at gmail.com> wrote: > >> > >> 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: > >> > > >> _______________________________________________ > >> rspec-users mailing list > >> rspec-users at rubyforge.org > >> http://rubyforge.org/mailman/listinfo/rspec-users > > > > > > _______________________________________________ > > rspec-users mailing list > > rspec-users at rubyforge.org > > http://rubyforge.org/mailman/listinfo/rspec-users > > > _______________________________________________ > rspec-users mailing list > rspec-users at rubyforge.org > http://rubyforge.org/mailman/listinfo/rspec-users >-------------- next part -------------- An HTML attachment was scrubbed... URL: <http://rubyforge.org/pipermail/rspec-users/attachments/20090102/b41a2fe1/attachment-0001.html>