Is there a way to use table name other than the default or to turn it around have multiple fixture files associated to the same table. Here''s my use case: I have multiple unit test classes that all work with the same model class and hence the same database table. However, for each test class I want the data to be in a different state. So I''d like to have something like class ModelATest < Test::Unit::TestCase fixtures :models_a # use file models_a.yml for table models ... end class ModelBTest < Test::Unit::TestCase fixtures :models_b # use file models_b.yml for table models ... end Thanks. Mike
You probably want something like this: http://dev.rubyonrails.org/ticket/1911 It''s scheduled for Rails 1.1, we''ve integrated it into the engines plugin in the meantime. - james On 12/15/05, Michael Fuller <mfuller-NZZuOrsC0EXYtjvyW6yDsg@public.gmane.org> wrote:> > Is there a way to use table name other than the default or to turn it around have multiple fixture files associated to the same table. > > Here''s my use case: I have multiple unit test classes that all work with the same model class and hence the same database table. However, for each test class I want the data to be in a different state. > > So I''d like to have something like > > class ModelATest < Test::Unit::TestCase > fixtures :models_a # use file models_a.yml for table models > > ... > end > > class ModelBTest < Test::Unit::TestCase > fixtures :models_b # use file models_b.yml for table models > > ... > end > > Thanks. > > Mike > _______________________________________________ > Rails mailing list > Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > http://lists.rubyonrails.org/mailman/listinfo/rails >
-----Original Message----- From: rails-bounces-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org [mailto:rails-bounces-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org] On Behalf Of James Adam Sent: Friday, December 16, 2005 10:13 AM To: rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org Subject: Re: [Rails] Fixtures and table name You probably want something like this: http://dev.rubyonrails.org/ticket/1911 It''s scheduled for Rails 1.1, we''ve integrated it into the engines plugin in the meantime. - james ------------------------------------ Thanks. One more reason to take a look at Engines.
Hey James, I''m desperately trying to use your implemntation of flexible fixtures. Here''s my line : fixture :scr_commit, :table_name=>"salesconfigreporting_history", :file_name=>"scr_history_committed" But the fiixture data is not loaded when the test is run. I''ve tried the data on a standard #fixtures call with the standard filename and it works OK. Ideas? On 12/16/05, James Adam <james.adam@gmail.com> wrote:> > You probably want something like this: > http://dev.rubyonrails.org/ticket/1911 > > It''s scheduled for Rails 1.1, we''ve integrated it into the engines > plugin in the meantime. > > - james > > On 12/15/05, Michael Fuller <mfuller@ihets.org> wrote: > > > > Is there a way to use table name other than the default or to turn it > around have multiple fixture files associated to the same table. > > > > Here''s my use case: I have multiple unit test classes that all work with > the same model class and hence the same database table. However, for each > test class I want the data to be in a different state. > > > > So I''d like to have something like > > > > class ModelATest < Test::Unit::TestCase > > fixtures :models_a # use file models_a.yml for table models > > > > ... > > end > > > > class ModelBTest < Test::Unit::TestCase > > fixtures :models_b # use file models_b.yml for table models > > > > ... > > end > > > > Thanks. > > > > Mike > > _______________________________________________ > > Rails mailing list > > Rails@lists.rubyonrails.org > > http://lists.rubyonrails.org/mailman/listinfo/rails > > > _______________________________________________ > Rails mailing list > Rails@lists.rubyonrails.org > http://lists.rubyonrails.org/mailman/listinfo/rails >-- ------------------------------ Apple MacBook. Black. It''s the new White! ------------------------------ Peter Fitzgibbons -------------- next part -------------- An HTML attachment was scrubbed... URL: http://wrath.rubyonrails.org/pipermail/rails/attachments/20060727/4bca2123/attachment.html