Fixtures vs Fixture class, what is the intended purpose?

Hello,
i am trying to fix the code for fixtures in rails because it is buggy
and internal variable names are confusing, could somebody please explain
to me what is the intended purpose of Fixture and Fixtures classes
respectively?

For example, why do we need both Fixtures.initializeand
Fixture.initialize? They both “initialize” a single fixture, and in
fact Fixture.initialize does nothing but set up two instance
variables, and it is not called anywhere in fixtures.rb. (Maybe i’ll
try to remove it and run tests, to see what happens.)

I am also considering to propose changing some fixtures API, like to
make the (undocumented?) class attribute
TestFixtures::fixture_table_names to hold a Hash of "fixture_name" => :table_name, similarly to TestFixtures::fixture_class_names holding
the Hash of "fixture_name" => FixtureModelClass (i would also propose
to rename). Currently TestFixtures::fixture_table_names holds an
Array. I am also trying to fix the meaning of fixture_name, which
before was sometimes used interchangeably with table_name: i want it
to be in the form "admin/users" instead of :admin_users, like the
form in which fixtures method accepts them.

So before making changes, i would like to understand what the classes
Fixtures, Fixture, TestFixtures, are exactly supposed to do, and why to
have so many. What is Fixture.initialize for?

Alexey.

I’ve figured out that Fixture is for a single row.

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs