Hello all, I''m having some issues with my test fixtures and unit tests and am hoping somebody has an idea about how to fix it. Background: I have a table in my legacy database called tp_approval_step. For this table I have a fixture called tp_approval_step.yml I have a model called ApprovalProcessStep that uses set_table_name ''tp_approval_step'' In my test file, ApprovalProcessStepTest, I have used set_fixture_class :tp_approval_step => ApprovalProcessStep Now whenever I run rake test:units I get this error: Unable to load tp_approval_step, underlying cause no such file to load -- tp_approval_step And not only do I get this for the example above, but I get it for every fixture in my rails app. Any help would be greatly appreciated. I want to get on with testing my code! -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
On 12 December 2010 17:30, Mike B <mberning-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> Hello all, > > I''m having some issues with my test fixtures and unit tests and am > hoping somebody has an idea about how to fix it. > > Background: > > I have a table in my legacy database called tp_approval_step. > For this table I have a fixture called tp_approval_step.yml > I have a model called ApprovalProcessStep that uses set_table_name > ''tp_approval_step'' > In my test file, ApprovalProcessStepTest, I have used > set_fixture_class :tp_approval_step => ApprovalProcessStep > > Now whenever I run rake test:units I get this error: > Unable to load tp_approval_step, underlying cause no such file to load > -- tp_approval_step > > And not only do I get this for the example above, but I get it for > every fixture in my rails app. > > Any help would be greatly appreciated. I want to get on with testing > my code! >I know it is not the answer you are looking for, so sorry in advance, but I think most nowadays would advise chucking fixtures in the bin and using Factories instead. Possibly Factory Girl or Machinist (I prefer Machinist). I have certainly not regretted it. The learning curve is only a few hours and you will get that back very soon. Colin -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Thanks for the ideas. I might have to go that route if I can''t get this figured out. Either that or skip fixtures and have my test cases completely load the database from scratch. Ideally I would like to stick with ''vanilla'' rails as much as possible. I''ve found that the more libraries you layer on top of your app the harder it is for people to come along after you and maintain/ enhance it. Mike On Dec 12, 12:46 pm, Colin Law <clan...-gM/Ye1E23mwN+BqQ9rBEUg@public.gmane.org> wrote:> On 12 December 2010 17:30, Mike B <mbern...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > > > > > > > > > Hello all, > > > I''m having some issues with my test fixtures and unit tests and am > > hoping somebody has an idea about how to fix it. > > > Background: > > > I have a table in my legacy database called tp_approval_step. > > For this table I have a fixture called tp_approval_step.yml > > I have a model called ApprovalProcessStep that uses set_table_name > > ''tp_approval_step'' > > In my test file, ApprovalProcessStepTest, I have used > > set_fixture_class :tp_approval_step => ApprovalProcessStep > > > Now whenever I run rake test:units I get this error: > > Unable to load tp_approval_step, underlying cause no such file to load > > -- tp_approval_step > > > And not only do I get this for the example above, but I get it for > > every fixture in my rails app. > > > Any help would be greatly appreciated. I want to get on with testing > > my code! > > I know it is not the answer you are looking for, so sorry in advance, > but I think most nowadays would advise chucking fixtures in the bin > and using Factories instead. Possibly Factory Girl or Machinist (I > prefer Machinist). I have certainly not regretted it. The learning > curve is only a few hours and you will get that back very soon. > > Colin-- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Marnen Laibow-Koser
2010-Dec-13 04:49 UTC
Re: Fixtures and unit tests - no such file to load
Mike B wrote in post #967999:> Thanks for the ideas. I might have to go that route if I can''t get > this figured out. Either that or skip fixtures and have my test cases > completely load the database from scratch. > > Ideally I would like to stick with ''vanilla'' rails as much as > possible. I''ve found that the more libraries you layer on top of your > app the harder it is for people to come along after you and maintain/ > enhance it.That''s not actually true in general, especially if you have decent test coverage. Personally, I''d rather maintain something with lots of (documented) libraries included than something with lots of reinvented wheels. Anyway, Colin is absolutely right. There is no reason to use fixtures and every reason to get rid of them. The Rails core team made a mistake in designing fixtures, and so they should be completely avoided.> > MikeBest, -- Marnen Laibow-Koser http://www.marnen.org marnen-sbuyVjPbboAdnm+yROfE0A@public.gmane.org Sent from my iPhone -- Posted via http://www.ruby-forum.com/. -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
On Dec 12, 11:49 pm, Marnen Laibow-Koser <li...-fsXkhYbjdPsEEoCn2XhGlw@public.gmane.org> wrote:> Mike B wrote in post #967999: > > > Thanks for the ideas. I might have to go that route if I can''t get > > this figured out. Either that or skip fixtures and have my test cases > > completely load the database from scratch. > > > Ideally I would like to stick with ''vanilla'' rails as much as > > possible. I''ve found that the more libraries you layer on top of your > > app the harder it is for people to come along after you and maintain/ > > enhance it. > > That''s not actually true in general, especially if you have decent test > coverage. Personally, I''d rather maintain something with lots of > (documented) libraries included than something with lots of reinvented > wheels. > > Anyway, Colin is absolutely right. There is no reason to use fixtures > and every reason to get rid of them. The Rails core team made a mistake > in designing fixtures, and so they should be completely avoided. > > Best, > -- > Marnen Laibow-Koserhttp://www.marnen.org > mar...-sbuyVjPbboAdnm+yROfE0A@public.gmane.orgOk, I have been convinced. I will switch over to using factories. Is there anything on the horizon (Rails 3+) that will fix or replace fixtures in Rails? -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
On 13 December 2010 15:22, Mike B <mberning-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> [...] > Is there anything on the horizon (Rails 3+) that will fix or replace > fixtures in Rails?I think most people use factory girl or machinist which are both available for Rails 3. Colin -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.