[Ruby] bootstrap data in test environment
Aaron Patterson
aaron_patterson at speakeasy.net
Tue Jan 16 12:02:00 PST 2007
On Tue, Jan 16, 2007 at 10:52:55AM -0800, Geoffrey Grosenbach wrote:
> On Tue, Jan 16, 2007 at 11:11:13AM -0800, Aaron Patterson wrote:
> > I'm working on a rails application with *lots* of bootstrap data (24
> > tables). I'd rather not specify 24 fixtures in my tests, so I was
> > wondering if there's a way to get rake to run db:bootstrap:load on the
> > test database after creating it?
>
> Another technique that I sometimes use is to load the fixtures in test_helper.rb, or make a class method on Test::Unit::TestCase that you can call from the tests that need it:
>
> class Test::Unit::TestCase
>
> # All test cases will load these
> fixtures :foo, :bar, :baz
>
> # OR...
>
> # Call this method from the tests that need it
> def self.load_my_fixtures
> fixtures :foo, :bar, :baz
> end
>
> end
Ah, perfect. I'll just specify them all in there. Thank you very much!
--Aaron
--
Aaron Patterson
http://tenderlovemaking.com/
More information about the Ruby
mailing list