Fixtures subdirectories


#1

Hi,

[This is a repost, I canÂ?t find where went my previous post,Â?]

I wanted to create subdirectories in the fixtures directory in order to
be
able to manage many different initial states for my system (or to sort
fixtures / corresponding model subpackages).

I came up with the idea of writing:

Test::Unit::TestCase.fixture_path = RAILS_ROOT +
“/test/fixtures/selling”

fixtures :customers, :partners

Test::Unit::TestCase.fixture_path = RAILS_ROOT +
“/test/fixtures/catalog”

fixtures :products, :parts

However, it looks like the test_help.rb file (in /lib) which is
written as:

Test::Unit::TestCase.fixture_path = RAILS_ROOT + "/test/fixtures/ "

def create_fixtures(*table_names)

Fixtures.create_fixtures(RAILS_ROOT + “/test/fixtures”, table_names)

end

could be rewritten as :

Test::Unit::TestCase.fixture_path = RAILS_ROOT + "/test/fixtures/ "

def create_fixtures(*table_names)

Fixtures.create_fixtures(Test::Unit::TestCase.fixture_path,
table_names)

end

in order to do the trick (and to respect the DRY principle,Â?).

What do you think?

Eric TORREBORRE

LTG Product Manager

LEIRIOS

TEMIS

18, rue Alain Savary

25000 Besançon

Phone: +33 (0)3 81 25 53 62

Fax: +33 (0)3 81 50 64 70

http://www.leirios.com/ www.leirios.com


CONFIDENTIALITY NOTICE

This e-mail message and any attachments are only for the use of the
intended
recipient and may contain information that is privileged, confidential
or
exempt from disclosure under applicable law. If you are not the intended
recipient, any disclosure, distribution or other use of this e-mail
message
or attachments is prohibited. If you have received this e-mail message
in
error, please delete and notify the sender immediately. Thank you.