Howto Make A Fixture Available in All Tests

Posted by Jeremy Voorhis Mon, 08 May 2006 03:43:00 GMT

In test/test_helper.rb:


class Test::Unit::TestCase
  def self.fixtures_with_users *names
    self.fixtures_without_users [:users, *names]
  end
  class << self; alias_method_chain :fixtures, :users end
end

Does anybody know another way to do this?

Comments

  1. Eric Hodel said about 19 hours later:

    You’ve got OO, use it:

    <pre>class MyTestCase < Test::Unit::TestCase fixture :users end

    class SomeTest < MyTestCase fixture :photos end</pre>

    1. ... tests
  2. Eric Hodel said about 19 hours later:

    PS: Please upgrade typo.

  3. JV said about 20 hours later:

    I’ve attempted a couple times. I haven’t found an easy way to migrate my data forward without losing anything.

(leave url/email »)