fixture_background 0.9.7 → 0.9.8
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/fixture_background/active_support/test_case.rb +4 -4
- data/lib/{mini_test → fixture_background/mini_test}/test_case.rb +0 -0
- data/lib/fixture_background/version.rb +1 -1
- data/lib/fixture_background.rb +1 -1
- data/test/rails3/Gemfile.lock +1 -1
- data/test/rails3/test/test_helper.rb +1 -1
- data/test/rails3/test/unit/person_test.rb +23 -4
- metadata +3 -3
@@ -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
|
-
|
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
|
|
File without changes
|
data/lib/fixture_background.rb
CHANGED
data/test/rails3/Gemfile.lock
CHANGED
@@ -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
|
-
|
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
|
-
|
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
|
-
-
|
9
|
-
version: 0.9.
|
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
|