fixture_background 0.9.8 → 0.9.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -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
- @generator = Generator.new(@full_class_name, background_signature, fixture_path, ancestors_and_own_background_blocks, @test_unit_class) unless background_valid?
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!
@@ -1,4 +1,4 @@
1
1
  module FixtureBackground
2
- VERSION = "0.9.8"
2
+ VERSION = "0.9.9"
3
3
  end
4
4
 
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: ../..
3
3
  specs:
4
- fixture_background (0.9.7)
4
+ fixture_background (0.9.8)
5
5
 
6
6
  GEM
7
7
  remote: http://rubygems.org/
@@ -96,7 +96,23 @@ class PersonTest < ActiveSupport::TestCase
96
96
  end
97
97
  end
98
98
 
99
- class ZZZEmptyDatabaseTest < ActiveSupport::TestCase
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
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 0
7
7
  - 9
8
- - 8
9
- version: 0.9.8
8
+ - 9
9
+ version: 0.9.9
10
10
  platform: ruby
11
11
  authors:
12
12
  - Thies C. Arntzen