fixture_background 0.9.8 → 0.9.9
Sign up to get free protection for your applications and to get access to all the features.
@@ -18,8 +18,6 @@ module FixtureBackground
|
|
18
18
|
end
|
19
19
|
|
20
20
|
def background(&blk)
|
21
|
-
set_callback(:setup, :before, :reset_active_record_fixture_cache, {:prepend => true})
|
22
|
-
set_callback(:setup, :before, :setup_background_ivars)
|
23
21
|
@fixture_background = FixtureBackground::Background.new(name, self, nil, blk)
|
24
22
|
end
|
25
23
|
end
|
@@ -69,8 +69,15 @@ module FixtureBackground
|
|
69
69
|
@full_class_name = full_class_name
|
70
70
|
@parent = parent
|
71
71
|
@background_block = blk
|
72
|
+
|
72
73
|
FixtureBackground.clean_database!
|
73
|
-
|
74
|
+
test_unit_class.set_callback(:setup, :before, :reset_active_record_fixture_cache, {:prepend => true})
|
75
|
+
test_unit_class.set_callback(:setup, :before, :setup_background_ivars)
|
76
|
+
|
77
|
+
@generator = Generator.new(
|
78
|
+
@full_class_name, background_signature, fixture_path,
|
79
|
+
ancestors_and_own_background_blocks, @test_unit_class
|
80
|
+
) unless background_valid?
|
74
81
|
end
|
75
82
|
|
76
83
|
def generate!
|
data/test/rails3/Gemfile.lock
CHANGED
@@ -96,7 +96,23 @@ class PersonTest < ActiveSupport::TestCase
|
|
96
96
|
end
|
97
97
|
end
|
98
98
|
|
99
|
-
class
|
99
|
+
class PersonWithoutGlobalBackgroundTest < ActiveSupport::TestCase
|
100
|
+
|
101
|
+
context "main context" do
|
102
|
+
|
103
|
+
background do
|
104
|
+
@person = Person.create(:name => "person")
|
105
|
+
end
|
106
|
+
|
107
|
+
context "without explicit background" do
|
108
|
+
should "instantiate ivars" do
|
109
|
+
assert_not_nil @person
|
110
|
+
end
|
111
|
+
end
|
112
|
+
end
|
113
|
+
end
|
114
|
+
|
115
|
+
class ZZZEmptyDatabaseTest < ActiveSupport::TestCase
|
100
116
|
should "have a clean database" do
|
101
117
|
assert_equal 0, Person.count
|
102
118
|
end
|