fixture_background 0.9.7 → 0.9.8

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.
@@ -6,9 +6,6 @@ module FixtureBackground
6
6
  included do
7
7
  class_inheritable_accessor :background_ivars
8
8
  class_inheritable_accessor :active_record_fixture_cache_resetted
9
-
10
- set_callback(:setup, :before, :reset_active_record_fixture_cache, {:prepend => true})
11
- set_callback(:setup, :before, :setup_background_ivars)
12
9
  end
13
10
 
14
11
  module ClassMethods
@@ -21,11 +18,14 @@ module FixtureBackground
21
18
  end
22
19
 
23
20
  def background(&blk)
24
- @fixture_background = FixtureBackground::Background.new(name, self, nil, blk)
21
+ set_callback(:setup, :before, :reset_active_record_fixture_cache, {:prepend => true})
22
+ set_callback(:setup, :before, :setup_background_ivars)
23
+ @fixture_background = FixtureBackground::Background.new(name, self, nil, blk)
25
24
  end
26
25
  end
27
26
 
28
27
  module InstanceMethods
28
+
29
29
  def setup_background_ivars
30
30
  self.background_ivars ||= IVars.deserialize((YAML.load_file("#{fixture_path}/ivars.dump") rescue {}))
31
31
 
@@ -1,4 +1,4 @@
1
1
  module FixtureBackground
2
- VERSION = "0.9.7"
2
+ VERSION = "0.9.8"
3
3
  end
4
4
 
@@ -4,4 +4,4 @@ require 'fixture_background/generator'
4
4
  require 'fixture_background/ivars'
5
5
  require 'fixture_background/shoulda'
6
6
  require 'fixture_background/active_support/test_case'
7
- require 'mini_test/test_case'
7
+ require 'fixture_background/mini_test/test_case'
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: ../..
3
3
  specs:
4
- fixture_background (0.9.6)
4
+ fixture_background (0.9.7)
5
5
 
6
6
  GEM
7
7
  remote: http://rubygems.org/
@@ -8,7 +8,7 @@ class ActiveSupport::TestCase
8
8
 
9
9
  fixtures :all
10
10
 
11
- def test_helper_returning_one
11
+ def some_test_helper_returning_one
12
12
  1
13
13
  end
14
14
  end
@@ -2,12 +2,31 @@ require 'test_helper'
2
2
 
3
3
  class PersonTest < ActiveSupport::TestCase
4
4
 
5
+ setup do
6
+ @instance_var_from_setup = nil
7
+ end
8
+
5
9
  background do
6
- test_helper_returning_one
10
+ some_test_helper_returning_one
7
11
  instance_test_helper_defined_after_background_returning_one
8
12
  @hase = Person.create(:name => "bunny")
13
+ @instance_var_from_setup = @hase
9
14
  end
10
-
15
+
16
+ should "be set from background" do
17
+ assert_not_nil @instance_var_from_setup
18
+ end
19
+
20
+ context "setup instance vars" do
21
+ background do
22
+ @instance_var_from_setup = Person.create(:name => "igel")
23
+ end
24
+
25
+ should "be set from background" do
26
+ assert_not_nil @instance_var_from_setup
27
+ end
28
+ end
29
+
11
30
  should "without context" do
12
31
  assert @hase
13
32
  assert_nil @thies
@@ -18,10 +37,10 @@ class PersonTest < ActiveSupport::TestCase
18
37
  should "not create post.yml" do
19
38
  assert !File.exist?(File.dirname(__FILE__) + '/../backgrounds/person_test/posts.yml')
20
39
  end
21
-
40
+
22
41
  context "with thies" do
23
42
  background do
24
- test_helper_returning_one
43
+ some_test_helper_returning_one
25
44
  instance_test_helper_defined_after_background_returning_one
26
45
  @thies = Person.create(:name => "thies")
27
46
  end
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 0
7
7
  - 9
8
- - 7
9
- version: 0.9.7
8
+ - 8
9
+ version: 0.9.8
10
10
  platform: ruby
11
11
  authors:
12
12
  - Thies C. Arntzen
@@ -41,9 +41,9 @@ files:
41
41
  - lib/fixture_background/background.rb
42
42
  - lib/fixture_background/generator.rb
43
43
  - lib/fixture_background/ivars.rb
44
+ - lib/fixture_background/mini_test/test_case.rb
44
45
  - lib/fixture_background/shoulda.rb
45
46
  - lib/fixture_background/version.rb
46
- - lib/mini_test/test_case.rb
47
47
  - test/rails3/.gitignore
48
48
  - test/rails3/Gemfile
49
49
  - test/rails3/Gemfile.lock