fixture_background 0.9.5 → 0.9.6

Sign up to get free protection for your applications and to get access to all the features.
@@ -17,10 +17,23 @@ module FixtureBackground
17
17
  end
18
18
  EOT
19
19
 
20
- background_to_use.generate!
20
+ klass.class_eval <<-EOT
21
+ cattr_accessor :fixture_background
22
+ @@background_generated = false
23
+
24
+ def initialize(*args)
25
+ super
26
+
27
+ if (background = fixture_background) && !@@background_generated
28
+ background.generate!
29
+ @@background_generated = true
30
+ self.class.fixtures :all
31
+ end
32
+ end
33
+ EOT
21
34
 
35
+ klass.fixture_background = background_to_use
22
36
  klass.fixture_path = background_to_use.fixture_path
23
- klass.fixtures :all
24
37
 
25
38
  Object.const_set(full_class_name, klass)
26
39
  end
@@ -1,4 +1,4 @@
1
1
  module FixtureBackground
2
- VERSION = "0.9.5"
2
+ VERSION = "0.9.6"
3
3
  end
4
4
 
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: ../..
3
3
  specs:
4
- fixture_background (0.9.2)
4
+ fixture_background (0.9.5)
5
5
 
6
6
  GEM
7
7
  remote: http://rubygems.org/
@@ -8,10 +8,6 @@ class PersonTest < ActiveSupport::TestCase
8
8
  @hase = Person.create(:name => "bunny")
9
9
  end
10
10
 
11
- def instance_test_helper_defined_after_background_returning_one
12
- 1
13
- end
14
-
15
11
  context "with thies" do
16
12
  background do
17
13
  some_test_helper_returning_one
@@ -26,7 +22,7 @@ class PersonTest < ActiveSupport::TestCase
26
22
  assert_nil @norman
27
23
  assert_equal 2, Person.count
28
24
  end
29
-
25
+
30
26
  context "with manuel" do
31
27
  background do
32
28
  @manuel = Person.create(:name => "manuel")
@@ -54,7 +50,7 @@ class PersonTest < ActiveSupport::TestCase
54
50
  end
55
51
  end
56
52
  end
57
-
53
+
58
54
  should "nother truth" do
59
55
  assert @hase
60
56
  assert @thies
@@ -63,8 +59,9 @@ class PersonTest < ActiveSupport::TestCase
63
59
  assert_equal 2, Person.count
64
60
  end
65
61
  end
66
-
67
- protected
68
-
62
+
63
+ def instance_test_helper_defined_after_background_returning_one
64
+ 1
65
+ end
69
66
 
70
67
  end
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 0
7
7
  - 9
8
- - 5
9
- version: 0.9.5
8
+ - 6
9
+ version: 0.9.6
10
10
  platform: ruby
11
11
  authors:
12
12
  - Thies C. Arntzen