There are YAML fixtures, there are CSV fixtures... but where are the SQL fixtures? I have reference data that I need in each environment and that is strictly read-only. I really don''t want to define YAML fixtures for this. I have the data as SQL statements anyway, what I need is a way to load it into the DB once before the other fixtures are loaded. Is there some easy way to do this? Michael -- Michael Schuerig Airtight arguments have mailto:michael-q5aiKMLteq4b1SvskN2V4Q@public.gmane.org vacuous conclusions. http://www.schuerig.de/michael/ --A.O. Rorty, Explaining Emotions
Michael Schuerig wrote:>There are YAML fixtures, there are CSV fixtures... but where are the SQL >fixtures? I have reference data that I need in each environment and that >is strictly read-only. I really don''t want to define YAML fixtures for >this. I have the data as SQL statements anyway, what I need is a way to >load it into the DB once before the other fixtures are loaded. Is there >some easy way to do this? > >If you already have the SQL statements, could you call them from the setup() method of the test class?
On Tuesday 16 August 2005 19:25, Steve Downey wrote:> Michael Schuerig wrote: > >There are YAML fixtures, there are CSV fixtures... but where are the > > SQL fixtures? I have reference data that I need in each environment > > and that is strictly read-only. I really don''t want to define YAML > > fixtures for this. I have the data as SQL statements anyway, what I > > need is a way to load it into the DB once before the other fixtures > > are loaded. Is there some easy way to do this? > > If you already have the SQL statements, could you call them from the > setup() method of the test class?Unless I''m mistaken, setup is called after the fixtures have been loaded which is too late in this case, because from my fixture data I need to refer to the data I have in SQL. Also, I''m not sure if it would work with transactional fixtures. Michael -- Michael Schuerig The more it stays the same, mailto:michael-q5aiKMLteq4b1SvskN2V4Q@public.gmane.org The less it changes! http://www.schuerig.de/michael/ --Spinal Tap, The Majesty of Rock
Depending on how long you need this reference data... I would edit the rake file and make a depend task that will be processed when you rake test_units Ken On 8/16/05, Michael Schuerig <michael-q5aiKMLteq4b1SvskN2V4Q@public.gmane.org> wrote:> On Tuesday 16 August 2005 19:25, Steve Downey wrote: > > Michael Schuerig wrote: > > >There are YAML fixtures, there are CSV fixtures... but where are the > > > SQL fixtures? I have reference data that I need in each environment > > > and that is strictly read-only. I really don''t want to define YAML > > > fixtures for this. I have the data as SQL statements anyway, what I > > > need is a way to load it into the DB once before the other fixtures > > > are loaded. Is there some easy way to do this? > > > > If you already have the SQL statements, could you call them from the > > setup() method of the test class? > > Unless I''m mistaken, setup is called after the fixtures have been loaded > which is too late in this case, because from my fixture data I need to > refer to the data I have in SQL. Also, I''m not sure if it would work > with transactional fixtures. > > Michael > > -- > Michael Schuerig The more it stays the same, > mailto:michael-q5aiKMLteq4b1SvskN2V4Q@public.gmane.org The less it changes! > http://www.schuerig.de/michael/ --Spinal Tap, The Majesty of Rock > _______________________________________________ > Rails mailing list > Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > http://lists.rubyonrails.org/mailman/listinfo/rails >
On Tuesday 16 August 2005 20:53, Ken Barker wrote:> Depending on how long you need this reference data... > > I would edit the rake file and make a depend task that will be > processed when you > > rake test_unitsThanks, that does work for tests run from rake. I''ll have a look at whether it is possible to make fixtures load SQL files themselves. Michael -- Michael Schuerig Airtight arguments have mailto:michael-q5aiKMLteq4b1SvskN2V4Q@public.gmane.org vacuous conclusions. http://www.schuerig.de/michael/ --A.O. Rorty, Explaining Emotions