lib/fixture_background/background.rb in fixture_background-0.9.4 vs lib/fixture_background/background.rb in fixture_background-0.9.5
- old
+ new
@@ -14,11 +14,13 @@
klass.instance_eval <<-EOT
def name
"#{parent_class.name}"
end
EOT
-
+
+ background_to_use.generate!
+
klass.fixture_path = background_to_use.fixture_path
klass.fixtures :all
Object.const_set(full_class_name, klass)
end
@@ -37,10 +39,14 @@
@test_unit_class = test_unit_class
@full_class_name = full_class_name
@parent = parent
@background_block = blk
- Generator.new(@full_class_name, background_signature, fixture_path, ancestors_and_own_background_blocks, @test_unit_class) unless background_valid?
+ @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
def ancestors_and_own_background_blocks
(@parent ? @parent.ancestors_and_own_background_blocks : []) << @background_block
end