Zach Dennis
2007-Aug-16 14:17 UTC
[rspec-users] undefined method `mock_model'' for [RSpec example]:#<Class:0x25550a8>
I am getting: undefined method `mock_model'' for [RSpec example]:#<Class:0x25550a8> with my view specs after upgrading to 1.0.8. Is anyone else seeing this? To isolate the message I did the following setup: - create new rails project (with edge) - installed rspec and rspec_on_rails - ran rake spec - ran script/generate rspec_scaffold products - tried to run a builtin view spec Zach
David Chelimsky
2007-Aug-16 14:32 UTC
[rspec-users] undefined method `mock_model'' for [RSpec example]:#<Class:0x25550a8>
On 8/16/07, Zach Dennis <zach.dennis at gmail.com> wrote:> I am getting: > undefined method `mock_model'' for [RSpec example]:#<Class:0x25550a8>The fact that it says [RSpec example] means that it''s not the right class for a view spec. The plugin knows how to create the right class based on one of two things: If the file is below /spec/views/ or describe "...", :behaviour_type => :view do ... If the spec you''re running satisfies either of these, you shouldn''t be seeing this.> > with my view specs after upgrading to 1.0.8. Is anyone else seeing this? > > To isolate the message I did the following setup: > > - create new rails project (with edge) > - installed rspec and rspec_on_rails > - ran rake spec > - ran script/generate rspec_scaffold products > - tried to run a builtin view specWhen you say "builtin view spec," do you mean one that was generated by running the rspec_scaffold generator?> > Zach > _______________________________________________ > rspec-users mailing list > rspec-users at rubyforge.org > http://rubyforge.org/mailman/listinfo/rspec-users >
Zach Dennis
2007-Aug-16 17:01 UTC
[rspec-users] undefined method `mock_model'' for [RSpec example]:#<Class:0x25550a8>
On 8/16/07, David Chelimsky <dchelimsky at gmail.com> wrote:> On 8/16/07, Zach Dennis <zach.dennis at gmail.com> wrote: > > I am getting: > > undefined method `mock_model'' for [RSpec example]:#<Class:0x25550a8> > > The fact that it says [RSpec example] means that it''s not the right > class for a view spec. The plugin knows how to create the right class > based on one of two things: > > If the file is below /spec/views/ > > or > > describe "...", :behaviour_type => :view do > ... > > If the spec you''re running satisfies either of these, you shouldn''t be > seeing this. > > > > > with my view specs after upgrading to 1.0.8. Is anyone else seeing this? > > > > To isolate the message I did the following setup: > > > > - create new rails project (with edge) > > - installed rspec and rspec_on_rails > > - ran rake spec > > - ran script/generate rspec_scaffold products > > - tried to run a builtin view spec > > When you say "builtin view spec," do you mean one that was generated > by running the rspec_scaffold generator? >One that was generated by the rspec_scaffold generator, Zach
David Chelimsky
2007-Aug-16 17:31 UTC
[rspec-users] undefined method `mock_model'' for [RSpec example]:#<Class:0x25550a8>
On 8/16/07, Zach Dennis <zach.dennis at gmail.com> wrote:> On 8/16/07, David Chelimsky <dchelimsky at gmail.com> wrote: > > On 8/16/07, Zach Dennis <zach.dennis at gmail.com> wrote: > > > I am getting: > > > undefined method `mock_model'' for [RSpec example]:#<Class:0x25550a8> > > > > The fact that it says [RSpec example] means that it''s not the right > > class for a view spec. The plugin knows how to create the right class > > based on one of two things: > > > > If the file is below /spec/views/ > > > > or > > > > describe "...", :behaviour_type => :view do > > ... > > > > If the spec you''re running satisfies either of these, you shouldn''t be > > seeing this. > > > > > > > > with my view specs after upgrading to 1.0.8. Is anyone else seeing this? > > > > > > To isolate the message I did the following setup: > > > > > > - create new rails project (with edge) > > > - installed rspec and rspec_on_rails > > > - ran rake spec > > > - ran script/generate rspec_scaffold products > > > - tried to run a builtin view spec > > > > When you say "builtin view spec," do you mean one that was generated > > by running the rspec_scaffold generator? > > > > One that was generated by the rspec_scaffold generator,Sorry man, it should be working fine. I''m not having that experience personally - is anybody else? Zach - what platform are you on?> > Zach >
Zach Dennis
2007-Aug-19 16:01 UTC
[rspec-users] undefined method `mock_model'' for [RSpec example]:#<Class:0x25550a8>
On 8/16/07, David Chelimsky <dchelimsky at gmail.com> wrote:> On 8/16/07, Zach Dennis <zach.dennis at gmail.com> wrote: > > On 8/16/07, David Chelimsky <dchelimsky at gmail.com> wrote: > > > On 8/16/07, Zach Dennis <zach.dennis at gmail.com> wrote: > > > > I am getting: > > > > undefined method `mock_model'' for [RSpec example]:#<Class:0x25550a8> > > > > > > The fact that it says [RSpec example] means that it''s not the right > > > class for a view spec. The plugin knows how to create the right class > > > based on one of two things: > > > > > > If the file is below /spec/views/ > > > > > > or > > > > > > describe "...", :behaviour_type => :view do > > > ... > > > > > > If the spec you''re running satisfies either of these, you shouldn''t be > > > seeing this. > > > > > > > > > > > with my view specs after upgrading to 1.0.8. Is anyone else seeing this? > > > > > > > > To isolate the message I did the following setup: > > > > > > > > - create new rails project (with edge) > > > > - installed rspec and rspec_on_rails > > > > - ran rake spec > > > > - ran script/generate rspec_scaffold products > > > > - tried to run a builtin view spec > > > > > > When you say "builtin view spec," do you mean one that was generated > > > by running the rspec_scaffold generator? > > > > > > > One that was generated by the rspec_scaffold generator, > > Sorry man, it should be working fine. I''m not having that experience > personally - is anybody else? > > Zach - what platform are you on? >I tried on OSX and also Kubuntu Feisty. I think the rspec scaffold generators need to be updated to include ", :behaviour_type => :view". Zach
David Chelimsky
2007-Aug-19 16:38 UTC
[rspec-users] undefined method `mock_model'' for [RSpec example]:#<Class:0x25550a8>
On 8/19/07, Zach Dennis <zach.dennis at gmail.com> wrote:> On 8/16/07, David Chelimsky <dchelimsky at gmail.com> wrote: > > On 8/16/07, Zach Dennis <zach.dennis at gmail.com> wrote: > > > On 8/16/07, David Chelimsky <dchelimsky at gmail.com> wrote: > > > > On 8/16/07, Zach Dennis <zach.dennis at gmail.com> wrote: > > > > > I am getting: > > > > > undefined method `mock_model'' for [RSpec example]:#<Class:0x25550a8> > > > > > > > > The fact that it says [RSpec example] means that it''s not the right > > > > class for a view spec. The plugin knows how to create the right class > > > > based on one of two things: > > > > > > > > If the file is below /spec/views/ > > > > > > > > or > > > > > > > > describe "...", :behaviour_type => :view do > > > > ... > > > > > > > > If the spec you''re running satisfies either of these, you shouldn''t be > > > > seeing this. > > > > > > > > > > > > > > with my view specs after upgrading to 1.0.8. Is anyone else seeing this? > > > > > > > > > > To isolate the message I did the following setup: > > > > > > > > > > - create new rails project (with edge) > > > > > - installed rspec and rspec_on_rails > > > > > - ran rake spec > > > > > - ran script/generate rspec_scaffold products > > > > > - tried to run a builtin view spec > > > > > > > > When you say "builtin view spec," do you mean one that was generated > > > > by running the rspec_scaffold generator? > > > > > > > > > > One that was generated by the rspec_scaffold generator, > > > > Sorry man, it should be working fine. I''m not having that experience > > personally - is anybody else? > > > > Zach - what platform are you on? > > > > I tried on OSX and also Kubuntu Feisty. I think the rspec scaffold > generators need to be updated to include ", :behaviour_type => > :view".I''d like to avoid that because it would be extra noise and it shouldn''t be necessary. The generated specs work absolutely perfectly for me as/is (I''m on OS X). There have been a couple of bugs related to regexps and windows paths over time, but they''ve either been resolved or await more feedback from users in the tracker. I''m thinking about other ways to be explicit about this (besides the verbose ":behaviour_type => :view". What if we added methods like: describe_model describe_view describe_controller describe_helper Or support the first argument being a Symbol: describe :model, "Thing" do I''m not sure I like those, but I kind of dislike :behaviour_type => :foo as a default. WDYT? David> > Zach > _______________________________________________ > rspec-users mailing list > rspec-users at rubyforge.org > http://rubyforge.org/mailman/listinfo/rspec-users >
aslak hellesoy
2007-Aug-20 08:35 UTC
[rspec-users] undefined method `mock_model'' for [RSpec example]:#<Class:0x25550a8>
On 8/19/07, David Chelimsky <dchelimsky at gmail.com> wrote:> On 8/19/07, Zach Dennis <zach.dennis at gmail.com> wrote: > > On 8/16/07, David Chelimsky <dchelimsky at gmail.com> wrote: > > > On 8/16/07, Zach Dennis <zach.dennis at gmail.com> wrote: > > > > On 8/16/07, David Chelimsky <dchelimsky at gmail.com> wrote: > > > > > On 8/16/07, Zach Dennis <zach.dennis at gmail.com> wrote: > > > > > > I am getting: > > > > > > undefined method `mock_model'' for [RSpec example]:#<Class:0x25550a8> > > > > > > > > > > The fact that it says [RSpec example] means that it''s not the right > > > > > class for a view spec. The plugin knows how to create the right class > > > > > based on one of two things: > > > > > > > > > > If the file is below /spec/views/ > > > > > > > > > > or > > > > > > > > > > describe "...", :behaviour_type => :view do > > > > > ... > > > > > > > > > > If the spec you''re running satisfies either of these, you shouldn''t be > > > > > seeing this. > > > > > > > > > > > > > > > > > with my view specs after upgrading to 1.0.8. Is anyone else seeing this? > > > > > > > > > > > > To isolate the message I did the following setup: > > > > > > > > > > > > - create new rails project (with edge) > > > > > > - installed rspec and rspec_on_rails > > > > > > - ran rake spec > > > > > > - ran script/generate rspec_scaffold products > > > > > > - tried to run a builtin view spec > > > > > > > > > > When you say "builtin view spec," do you mean one that was generated > > > > > by running the rspec_scaffold generator? > > > > > > > > > > > > > One that was generated by the rspec_scaffold generator, > > > > > > Sorry man, it should be working fine. I''m not having that experience > > > personally - is anybody else? > > > > > > Zach - what platform are you on? > > > > > > > I tried on OSX and also Kubuntu Feisty. I think the rspec scaffold > > generators need to be updated to include ", :behaviour_type => > > :view". > > I''d like to avoid that because it would be extra noise and it > shouldn''t be necessary. The generated specs work absolutely perfectly > for me as/is (I''m on OS X). There have been a couple of bugs related > to regexps and windows paths over time, but they''ve either been > resolved or await more feedback from users in the tracker. > > I''m thinking about other ways to be explicit about this (besides the > verbose ":behaviour_type => :view". What if we added methods like: > > describe_model > describe_view > describe_controller > describe_helper >I like these. They are explicit.> Or support the first argument being a Symbol: > > describe :model, "Thing" do > > I''m not sure I like those, but I kind of dislike :behaviour_type => > :foo as a default. > > WDYT? > > David > > > > > > Zach > > _______________________________________________ > > 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 >
Michael Klishin
2007-Aug-20 10:09 UTC
[rspec-users] undefined method `mock_model'' for [RSpec example]:#<Class:0x25550a8>
+1 for those On 19/08/07, David Chelimsky <dchelimsky at gmail.com> wrote:> I''m thinking about other ways to be explicit about this (besides the > verbose ":behaviour_type => :view". What if we added methods like: > > describe_model > describe_view > describe_controller > describe_helper-- MK
Jay Levitt
2007-Aug-20 11:52 UTC
[rspec-users] undefined method `mock_model'' for [RSpec example]:#<Class:0x25550a8>
> I''d like to avoid that because it would be extra noise and it > shouldn''t be necessary. The generated specs work absolutely perfectly > for me as/is (I''m on OS X). There have been a couple of bugs related > to regexps and windows paths over time, but they''ve either been > resolved or await more feedback from users in the tracker. > > I''m thinking about other ways to be explicit about this (besides the > verbose ":behaviour_type => :view". What if we added methods like: > > describe_model > describe_view > describe_controller > describe_helper > > Or support the first argument being a Symbol: > > describe :model, "Thing" doI''m not clear why we need any new syntax at all - isn''t this just a bug related to some configurations, if it works for David but not for Zach (both on OS X)? Jay> > I''m not sure I like those, but I kind of dislike :behaviour_type => > :foo as a default. > > WDYT? > > David > > >> Zach >> _______________________________________________ >> 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
aslak hellesoy
2007-Aug-20 12:20 UTC
[rspec-users] undefined method `mock_model'' for [RSpec example]:#<Class:0x25550a8>
On 8/20/07, Jay Levitt <lists-rspec at shopwatch.org> wrote:> > I''d like to avoid that because it would be extra noise and it > > shouldn''t be necessary. The generated specs work absolutely perfectly > > for me as/is (I''m on OS X). There have been a couple of bugs related > > to regexps and windows paths over time, but they''ve either been > > resolved or await more feedback from users in the tracker. > > > > I''m thinking about other ways to be explicit about this (besides the > > verbose ":behaviour_type => :view". What if we added methods like: > > > > describe_model > > describe_view > > describe_controller > > describe_helper > > > > Or support the first argument being a Symbol: > > > > describe :model, "Thing" do > > I''m not clear why we need any new syntax at all - isn''t this just a bug > related to some configurations, if it works for David but not for Zach > (both on OS X)? >Good point. Let''s figure out why it doesn''t work for Zach first. Zach: What''s the relative path of the spec? Did you move it after it was created? Aslak> Jay > > > > I''m not sure I like those, but I kind of dislike :behaviour_type => > > :foo as a default. > > > > WDYT? > > > > David > > > > > >> Zach > >> _______________________________________________ > >> 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 >
Jay Levitt
2007-Aug-20 12:45 UTC
[rspec-users] undefined method `mock_model'' for [RSpec example]:#<Class:0x25550a8>
On 8/20/2007 8:20 AM, aslak hellesoy wrote:> On 8/20/07, Jay Levitt <lists-rspec at shopwatch.org> wrote: >>> I''d like to avoid that because it would be extra noise and it >>> shouldn''t be necessary. The generated specs work absolutely perfectly >>> for me as/is (I''m on OS X). There have been a couple of bugs related >>> to regexps and windows paths over time, but they''ve either been >>> resolved or await more feedback from users in the tracker. >>> >>> I''m thinking about other ways to be explicit about this (besides the >>> verbose ":behaviour_type => :view". What if we added methods like: >>> >>> describe_model >>> describe_view >>> describe_controller >>> describe_helper >>> >>> Or support the first argument being a Symbol: >>> >>> describe :model, "Thing" do >> I''m not clear why we need any new syntax at all - isn''t this just a bug >> related to some configurations, if it works for David but not for Zach >> (both on OS X)? >> > > Good point. Let''s figure out why it doesn''t work for Zach first. > > Zach: What''s the relative path of the spec? Did you move it after it > was created?If Zach could create a screencast or precise step-by-step, I can attempt to reproduce it tonight on OS X, Windows XP, Cygwin, and/or Ubuntu 6.06. Jay
Jay Levitt
2007-Aug-20 13:38 UTC
[rspec-users] undefined method `mock_model'' for [RSpec example]:#<Class:0x25550a8>
aslak hellesoy wrote:> On 8/20/07, Jay Levitt <lists-rspec at shopwatch.org> wrote: >>> I''d like to avoid that because it would be extra noise and it >>> shouldn''t be necessary. The generated specs work absolutely perfectly >>> for me as/is (I''m on OS X). There have been a couple of bugs related >>> to regexps and windows paths over time, but they''ve either been >>> resolved or await more feedback from users in the tracker. >>> >>> I''m thinking about other ways to be explicit about this (besides the >>> verbose ":behaviour_type => :view". What if we added methods like: >>> >>> describe_model >>> describe_view >>> describe_controller >>> describe_helper >>> >>> Or support the first argument being a Symbol: >>> >>> describe :model, "Thing" do >> I''m not clear why we need any new syntax at all - isn''t this just a bug >> related to some configurations, if it works for David but not for Zach >> (both on OS X)? >> > > Good point. Let''s figure out why it doesn''t work for Zach first. > > Zach: What''s the relative path of the spec? Did you move it after it > was created?If Zach could create a screencast or precise step-by-step, I can attempt to reproduce it tonight on OS X, Windows XP, Cygwin, and/or Ubuntu 6.06. Jay
David Chelimsky
2007-Aug-20 13:47 UTC
[rspec-users] undefined method `mock_model'' for [RSpec example]:#<Class:0x25550a8>
On 8/20/07, Jay Levitt <lists-rspec at shopwatch.org> wrote:> aslak hellesoy wrote: > > On 8/20/07, Jay Levitt <lists-rspec at shopwatch.org> wrote: > >>> I''d like to avoid that because it would be extra noise and it > >>> shouldn''t be necessary. The generated specs work absolutely perfectly > >>> for me as/is (I''m on OS X). There have been a couple of bugs related > >>> to regexps and windows paths over time, but they''ve either been > >>> resolved or await more feedback from users in the tracker. > >>> > >>> I''m thinking about other ways to be explicit about this (besides the > >>> verbose ":behaviour_type => :view". What if we added methods like: > >>> > >>> describe_model > >>> describe_view > >>> describe_controller > >>> describe_helper > >>> > >>> Or support the first argument being a Symbol: > >>> > >>> describe :model, "Thing" do > >> I''m not clear why we need any new syntax at all - isn''t this just a bug > >> related to some configurations, if it works for David but not for Zach > >> (both on OS X)? > >> > > > > Good point. Let''s figure out why it doesn''t work for Zach first. > > > > Zach: What''s the relative path of the spec? Did you move it after it > > was created? > > If Zach could create a screencast or precise step-by-step, I can attempt > to reproduce it tonight on OS X, Windows XP, Cygwin, and/or Ubuntu 6.06.Thanks for offering to do this Jay - that''s great.> > Jay > > > _______________________________________________ > rspec-users mailing list > rspec-users at rubyforge.org > http://rubyforge.org/mailman/listinfo/rspec-users >
Zach Dennis
2007-Aug-20 23:25 UTC
[rspec-users] undefined method `mock_model'' for [RSpec example]:#<Class:0x25550a8>
Here is a link to the .mov: http://www.continuousthinking.com/movies/RSpec_mockModelError.mov In doing this I realized something. I only get the error when I try to run an individual spec within the spec/views/<model_name>/ directory. Thanks for the suggestion Jay, Zach On 8/20/07, David Chelimsky <dchelimsky at gmail.com> wrote:> On 8/20/07, Jay Levitt <lists-rspec at shopwatch.org> wrote: > > aslak hellesoy wrote: > > > On 8/20/07, Jay Levitt <lists-rspec at shopwatch.org> wrote: > > >>> I''d like to avoid that because it would be extra noise and it > > >>> shouldn''t be necessary. The generated specs work absolutely perfectly > > >>> for me as/is (I''m on OS X). There have been a couple of bugs related > > >>> to regexps and windows paths over time, but they''ve either been > > >>> resolved or await more feedback from users in the tracker. > > >>> > > >>> I''m thinking about other ways to be explicit about this (besides the > > >>> verbose ":behaviour_type => :view". What if we added methods like: > > >>> > > >>> describe_model > > >>> describe_view > > >>> describe_controller > > >>> describe_helper > > >>> > > >>> Or support the first argument being a Symbol: > > >>> > > >>> describe :model, "Thing" do > > >> I''m not clear why we need any new syntax at all - isn''t this just a bug > > >> related to some configurations, if it works for David but not for Zach > > >> (both on OS X)? > > >> > > > > > > Good point. Let''s figure out why it doesn''t work for Zach first. > > > > > > Zach: What''s the relative path of the spec? Did you move it after it > > > was created? > > > > If Zach could create a screencast or precise step-by-step, I can attempt > > to reproduce it tonight on OS X, Windows XP, Cygwin, and/or Ubuntu 6.06. > > Thanks for offering to do this Jay - that''s great. > > > > > Jay > > > > > > _______________________________________________ > > 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 >
aslak hellesoy
2007-Aug-21 00:19 UTC
[rspec-users] undefined method `mock_model'' for [RSpec example]:#<Class:0x25550a8>
Several problems here: First, rspec_scaffold must be given a *singularised* name, in your case ''product''. (This is Rails being finicky, not RSpec). Second, after running rspec_scaffold you must run rake db:migrate Third, before you can run specs with ruby or spec, you must create the test database. This can be done with rake spec or rake db:test:prepare HTH, Aslak On 8/21/07, Zach Dennis <zach.dennis at gmail.com> wrote:> Here is a link to the .mov: > > http://www.continuousthinking.com/movies/RSpec_mockModelError.mov > > In doing this I realized something. I only get the error when I try to > run an individual spec within the spec/views/<model_name>/ directory. > Thanks for the suggestion Jay, > > Zach > > > > On 8/20/07, David Chelimsky <dchelimsky at gmail.com> wrote: > > On 8/20/07, Jay Levitt <lists-rspec at shopwatch.org> wrote: > > > aslak hellesoy wrote: > > > > On 8/20/07, Jay Levitt <lists-rspec at shopwatch.org> wrote: > > > >>> I''d like to avoid that because it would be extra noise and it > > > >>> shouldn''t be necessary. The generated specs work absolutely perfectly > > > >>> for me as/is (I''m on OS X). There have been a couple of bugs related > > > >>> to regexps and windows paths over time, but they''ve either been > > > >>> resolved or await more feedback from users in the tracker. > > > >>> > > > >>> I''m thinking about other ways to be explicit about this (besides the > > > >>> verbose ":behaviour_type => :view". What if we added methods like: > > > >>> > > > >>> describe_model > > > >>> describe_view > > > >>> describe_controller > > > >>> describe_helper > > > >>> > > > >>> Or support the first argument being a Symbol: > > > >>> > > > >>> describe :model, "Thing" do > > > >> I''m not clear why we need any new syntax at all - isn''t this just a bug > > > >> related to some configurations, if it works for David but not for Zach > > > >> (both on OS X)? > > > >> > > > > > > > > Good point. Let''s figure out why it doesn''t work for Zach first. > > > > > > > > Zach: What''s the relative path of the spec? Did you move it after it > > > > was created? > > > > > > If Zach could create a screencast or precise step-by-step, I can attempt > > > to reproduce it tonight on OS X, Windows XP, Cygwin, and/or Ubuntu 6.06. > > > > Thanks for offering to do this Jay - that''s great. > > > > > > > > Jay > > > > > > > > > _______________________________________________ > > > 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 >
Zach Dennis
2007-Aug-21 01:55 UTC
[rspec-users] undefined method `mock_model'' for [RSpec example]:#<Class:0x25550a8>
On 8/20/07, aslak hellesoy <aslak.hellesoy at gmail.com> wrote:> Several problems here: > > First, rspec_scaffold must be given a *singularised* name, in your > case ''product''. (This is Rails being finicky, not RSpec).ok> Second, after running rspec_scaffold you must run rake db:migrateThis I didn''t do, but doing this makes no difference on the mock model error. This does fix the issue if I run the spec from RAILS_ROOT, but not if I run the spec from within the spec/views/products directory.> Third, before you can run specs with ruby or spec, you must create the > test database. This can be done with rake spec or rake db:test:prepareThe database was already in existence, so I left that part omitted in the video If I run specs from RAILS_ROOT then everything works, but not if I''m not in RAILS_ROOT. This is less of an issue I originally thought, but the directory thing is a minor irritation, although I can make sure to run specs from the RAILS_ROOT. thx, Zach
David Chelimsky
2007-Aug-21 02:01 UTC
[rspec-users] undefined method `mock_model'' for [RSpec example]:#<Class:0x25550a8>
On 8/20/07, Zach Dennis <zach.dennis at gmail.com> wrote:> On 8/20/07, aslak hellesoy <aslak.hellesoy at gmail.com> wrote: > > Several problems here: > > > > First, rspec_scaffold must be given a *singularised* name, in your > > case ''product''. (This is Rails being finicky, not RSpec). > > ok > > > Second, after running rspec_scaffold you must run rake db:migrate > > This I didn''t do, but doing this makes no difference on the mock model > error. This does fix the issue if I run the spec from RAILS_ROOT, but > not if I run the spec from within the spec/views/products directory.Ah - now THAT makes sense. This won''t work on any system at all. RSpec looks for /spec/views/ in the path to know that it''s a view spec. If you''re in the view spec directory, it doesn''t get the information it needs. Make sense?> > Third, before you can run specs with ruby or spec, you must create the > > test database. This can be done with rake spec or rake db:test:prepare > > The database was already in existence, so I left that part omitted in the video > > If I run specs from RAILS_ROOT then everything works, but not if I''m > not in RAILS_ROOT. This is less of an issue I originally thought, but > the directory thing is a minor irritation, although I can make sure to > run specs from the RAILS_ROOT.We''d have to change how rspec figures out what behaviour_type to use to reduce the irritation. Any suggestions?> > thx, > > Zach > _______________________________________________ > rspec-users mailing list > rspec-users at rubyforge.org > http://rubyforge.org/mailman/listinfo/rspec-users >
Zach Dennis
2007-Aug-24 14:53 UTC
[rspec-users] undefined method `mock_model'' for [RSpec example]:#<Class:0x25550a8>
On 8/20/07, David Chelimsky <dchelimsky at gmail.com> wrote:> On 8/20/07, Zach Dennis <zach.dennis at gmail.com> wrote: > > On 8/20/07, aslak hellesoy <aslak.hellesoy at gmail.com> wrote: > > > Several problems here: > > > > > > First, rspec_scaffold must be given a *singularised* name, in your > > > case ''product''. (This is Rails being finicky, not RSpec). > > > > ok > > > > > Second, after running rspec_scaffold you must run rake db:migrate > > > > This I didn''t do, but doing this makes no difference on the mock model > > error. This does fix the issue if I run the spec from RAILS_ROOT, but > > not if I run the spec from within the spec/views/products directory. > > Ah - now THAT makes sense. This won''t work on any system at all. RSpec > looks for /spec/views/ in the path to know that it''s a view spec. If > you''re in the view spec directory, it doesn''t get the information it > needs. Make sense? > > > > Third, before you can run specs with ruby or spec, you must create the > > > test database. This can be done with rake spec or rake db:test:prepare > > > > The database was already in existence, so I left that part omitted in the video > > > > If I run specs from RAILS_ROOT then everything works, but not if I''m > > not in RAILS_ROOT. This is less of an issue I originally thought, but > > the directory thing is a minor irritation, although I can make sure to > > run specs from the RAILS_ROOT. > > We''d have to change how rspec figures out what behaviour_type to use > to reduce the irritation. Any suggestions?Use expand_path on the current file and see if it is in RAILS_ROOT/specs/views ? Zach