Forum: Ruby on Rails Fixtures and table name

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
85de428f7dfe6f826db39f46aa91ef89?d=identicon&s=25 Michael Fuller (Guest)
on 2005-12-15 01:54
(Received via mailing list)
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
05d703f649ef1d07e78d7b479fb4c4ac?d=identicon&s=25 James Adam (Guest)
on 2005-12-16 16:15
(Received via mailing list)
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
3203ed0e608d3bfae1e31282e629ffa2?d=identicon&s=25 Peter Fitzgibbons (Guest)
on 2006-07-27 23:18
(Received via mailing list)
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?
This topic is locked and can not be replied to.