lib/fixture_background/background.rb in fixture_background-0.9.8 vs lib/fixture_background/background.rb in fixture_background-0.9.9
- old
+ new
@@ -67,11 +67,18 @@
def initialize(full_class_name, test_unit_class, parent, blk)
@test_unit_class = test_unit_class
@full_class_name = full_class_name
@parent = parent
@background_block = blk
+
FixtureBackground.clean_database!
- @generator = Generator.new(@full_class_name, background_signature, fixture_path, ancestors_and_own_background_blocks, @test_unit_class) unless background_valid?
+ test_unit_class.set_callback(:setup, :before, :reset_active_record_fixture_cache, {:prepend => true})
+ test_unit_class.set_callback(:setup, :before, :setup_background_ivars)
+
+ @generator = Generator.new(
+ @full_class_name, background_signature, fixture_path,
+ ancestors_and_own_background_blocks, @test_unit_class
+ ) unless background_valid?
end
def generate!
@generator.generate! if @generator
end