Kevin Williams
2007-Feb-28 22:19 UTC
[rspec-users] acts_as_authenticated error with Object#id
I''m getting this when I run my Rails controller specs. <projectroot>/config/../lib/authenticated_system.rb:16: warning: Object#id will be deprecated; use Object#object_id I added "include AuthenticatedTestHelper" to /spec/spec_helper.rb so that my controller tests^H^H^H^H^Hspecs can use the "login_as" helper method. Anyone know how to fix this? -- Cheers, Kevin Williams http://www.almostserio.us/ "Any sufficiently advanced technology is indistinguishable from Magic." - Arthur C. Clarke
David Chelimsky
2007-Mar-01 00:02 UTC
[rspec-users] acts_as_authenticated error with Object#id
On 2/28/07, Kevin Williams <kevwil at gmail.com> wrote:> I''m getting this when I run my Rails controller specs. > > <projectroot>/config/../lib/authenticated_system.rb:16: warning: Object#id > will be deprecated; use Object#object_id > > I added "include AuthenticatedTestHelper" to /spec/spec_helper.rb so > that my controller tests^H^H^H^H^Hspecs can use the "login_as" helper > method. Anyone know how to fix this?This usually comes from something calling #id on a mock of a model. Are you mocking any AR models? If so, be sure to stub!(:id).and_return(a_string). David> > > -- > Cheers, > > Kevin Williams > http://www.almostserio.us/ > > "Any sufficiently advanced technology is indistinguishable from > Magic." - Arthur C. Clarke > _______________________________________________ > rspec-users mailing list > rspec-users at rubyforge.org > http://rubyforge.org/mailman/listinfo/rspec-users >
aslak hellesoy
2007-Mar-01 02:37 UTC
[rspec-users] acts_as_authenticated error with Object#id
On 3/1/07, David Chelimsky <dchelimsky at gmail.com> wrote:> On 2/28/07, Kevin Williams <kevwil at gmail.com> wrote: > > I''m getting this when I run my Rails controller specs. > > > > <projectroot>/config/../lib/authenticated_system.rb:16: warning: Object#id > > will be deprecated; use Object#object_id > > > > I added "include AuthenticatedTestHelper" to /spec/spec_helper.rb so > > that my controller tests^H^H^H^H^Hspecs can use the "login_as" helper > > method. Anyone know how to fix this? > > This usually comes from something calling #id on a mock of a model. > Are you mocking any AR models? If so, be sure to > stub!(:id).and_return(a_string). >Or use mock_model(SomeClass) and get it for free. It also takes care of stubbing #to_param, which is heavily used by ActionPack. Aslak> David > > > > > > > -- > > Cheers, > > > > Kevin Williams > > http://www.almostserio.us/ > > > > "Any sufficiently advanced technology is indistinguishable from > > Magic." - Arthur C. Clarke > > _______________________________________________ > > 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 >
David Chelimsky
2007-Mar-01 03:54 UTC
[rspec-users] acts_as_authenticated error with Object#id
On 2/28/07, aslak hellesoy <aslak.hellesoy at gmail.com> wrote:> On 3/1/07, David Chelimsky <dchelimsky at gmail.com> wrote: > > On 2/28/07, Kevin Williams <kevwil at gmail.com> wrote: > > > I''m getting this when I run my Rails controller specs. > > > > > > <projectroot>/config/../lib/authenticated_system.rb:16: warning: Object#id > > > will be deprecated; use Object#object_id > > > > > > I added "include AuthenticatedTestHelper" to /spec/spec_helper.rb so > > > that my controller tests^H^H^H^H^Hspecs can use the "login_as" helper > > > method. Anyone know how to fix this? > > > > This usually comes from something calling #id on a mock of a model. > > Are you mocking any AR models? If so, be sure to > > stub!(:id).and_return(a_string). > > > > Or use mock_model(SomeClass) and get it for free. It also takes care > of stubbing #to_param, which is heavily used by ActionPack.Here''s the deets on that: http://rspec.rubyforge.org/rdoc-rails/classes/Spec/Rails/Runner/EvalContext.html> > Aslak > > > David > > > > > > > > > > > -- > > > Cheers, > > > > > > Kevin Williams > > > http://www.almostserio.us/ > > > > > > "Any sufficiently advanced technology is indistinguishable from > > > Magic." - Arthur C. Clarke > > > _______________________________________________ > > > 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 >
Kevin Williams
2007-Mar-01 14:34 UTC
[rspec-users] acts_as_authenticated error with Object#id
No, this isn''t a mock AFAIK. The ''login_as(:quentin)'' code uses the data from the fixtures, so it should be loading from the test database. On 2/28/07, David Chelimsky <dchelimsky at gmail.com> wrote:> On 2/28/07, Kevin Williams <kevwil at gmail.com> wrote: > > I''m getting this when I run my Rails controller specs. > > > > <projectroot>/config/../lib/authenticated_system.rb:16: warning: Object#id > > will be deprecated; use Object#object_id > > > > I added "include AuthenticatedTestHelper" to /spec/spec_helper.rb so > > that my controller tests^H^H^H^H^Hspecs can use the "login_as" helper > > method. Anyone know how to fix this? > > This usually comes from something calling #id on a mock of a model. > Are you mocking any AR models? If so, be sure to > stub!(:id).and_return(a_string). > > David > > > > > > > -- > > Cheers, > > > > Kevin Williams > > http://www.almostserio.us/ > > > > "Any sufficiently advanced technology is indistinguishable from > > Magic." - Arthur C. Clarke > > _______________________________________________ > > 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 >-- Cheers, Kevin Williams http://www.almostserio.us/ "Any sufficiently advanced technology is indistinguishable from Magic." - Arthur C. Clarke