forking_test_runner 0.1.0 → 0.1.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: f37240f61aa8ac0e9020b79cc2d3c7482e072022
4
- data.tar.gz: bce3260c8d8b39a57ce69c7ad942f886a080ffe8
3
+ metadata.gz: 22ab9381cfa421a0a5f4a088adc481a611f79938
4
+ data.tar.gz: aa7438cba9f5b2d176601dd9397a23961101c8bb
5
5
  SHA512:
6
- metadata.gz: 4483cbd72e290e710ac6608fee73935d4f88b509e76e8b3d57ca7fe9cb07cec41bc1eb187c0cc97448aa11ac858a63cfefbfd5fc9e04e957cf0a7cbe16e08c00
7
- data.tar.gz: 4d79162fd8512fe21669bdfe131efcc2cdd8f4a2aa5016f2b40cee9194ff6e78eb4e20a34b08c121dccc1e085aae5fbf35fb125b354aac6d52f19b98b7177c27
6
+ metadata.gz: 8446a924b2e3c4e354a6f305bdc22831180dca3ac80b8c02407bf41c7abfb6dbe8e72b715c20c7824c3fc1e98b166ed844a586d5ef6b97a977372c8d01783563
7
+ data.tar.gz: 0492172f5127a14e2f0ff53c60fe23a591a57687f70beb6dd9994d4646a4234cd74cb34648ed415c27b6649186e8afb4fda026353025cf06c7f3a08e52d5fc63
@@ -7,38 +7,37 @@ module ForkingTestRunner
7
7
  return if @preloaded
8
8
  @preloaded = true
9
9
 
10
+ fixtures = (ActiveSupport::VERSION::MAJOR == 3 ? ActiveRecord::Fixtures : ActiveRecord::FixtureSet)
11
+
10
12
  # reuse our pre-loaded fixtures even if we have a different connection
11
- class << ActiveRecord::Fixtures
12
- def cache_for_connection(connection)
13
- ActiveRecord::Fixtures.class_variable_get(:@@all_cached_fixtures)[:unique]
14
- end
13
+ fixtures.send(:define_method, :cache_for_connection) do |_connection|
14
+ fixtures.class_variable_get(:@@all_cached_fixtures)[:unique]
15
15
  end
16
16
 
17
17
  ActiveSupport::TestCase.fixtures :all
18
18
 
19
- ActiveRecord::Fixtures.create_fixtures(
20
- ActiveRecord::TestCase.fixture_path,
21
- ActiveRecord::TestCase.fixture_table_names,
22
- ActiveRecord::TestCase.fixture_class_names
19
+ fixtures.create_fixtures(
20
+ ActiveSupport::TestCase.fixture_path,
21
+ ActiveSupport::TestCase.fixture_table_names,
22
+ ActiveSupport::TestCase.fixture_class_names
23
23
  )
24
24
  end
25
25
 
26
26
  # don't let minitest setup another exit hook
27
27
  def disable_minitest_autorun
28
- require 'minitest/unit'
29
- MiniTest::Unit.class_variable_set("@@installed_at_exit", true)
28
+ toggle_minitest_autorun false
30
29
  end
31
30
 
32
31
  def enabled_minitest_autorun
33
- MiniTest::Unit.class_variable_set(:@@installed_at_exit, false)
34
- MiniTest::Unit.autorun
32
+ toggle_minitest_autorun true
35
33
  end
36
34
 
37
35
  def run_test(file)
38
36
  preload_fixtures
39
37
  ActiveRecord::Base.connection.disconnect!
40
38
  child = fork do
41
- ActiveRecord::Base.establish_connection 'test'
39
+ key = (ActiveRecord::VERSION::STRING >= "4.1.0" ? :test : "test")
40
+ ActiveRecord::Base.establish_connection key
42
41
  enabled_minitest_autorun
43
42
  require "./#{file}"
44
43
  end
@@ -81,5 +80,23 @@ module ForkingTestRunner
81
80
  argv.delete_at(index)
82
81
  argv.delete_at(index)
83
82
  end
83
+
84
+ private
85
+
86
+ def toggle_minitest_autorun(value)
87
+ begin
88
+ require 'minitest/test' # only exists on > 5
89
+ rescue LoadError
90
+ require 'minitest/unit'
91
+ end
92
+ klass = if defined?(Minitest::Test)
93
+ Minitest
94
+ else
95
+ # require 'minitest/unit'
96
+ MiniTest::Unit
97
+ end
98
+ klass.class_variable_set("@@installed_at_exit", !value)
99
+ klass.autorun if value
100
+ end
84
101
  end
85
102
  end
@@ -1,3 +1,3 @@
1
1
  module ForkingTestRunner
2
- VERSION = "0.1.0"
2
+ VERSION = "0.1.1"
3
3
  end
metadata CHANGED
@@ -1,27 +1,27 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: forking_test_runner
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Michael Grosser
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-03-19 00:00:00.000000000 Z
11
+ date: 2015-03-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: parallel_tests
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - '='
17
+ - - ">="
18
18
  - !ruby/object:Gem::Version
19
19
  version: 1.3.7
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - '='
24
+ - - ">="
25
25
  - !ruby/object:Gem::Version
26
26
  version: 1.3.7
27
27
  - !ruby/object:Gem::Dependency
@@ -30,14 +30,98 @@ dependencies:
30
30
  requirements:
31
31
  - - "<"
32
32
  - !ruby/object:Gem::Version
33
- version: 4.0.0
33
+ version: 5.0.0
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
38
  - - "<"
39
39
  - !ruby/object:Gem::Version
40
- version: 4.0.0
40
+ version: 5.0.0
41
+ - !ruby/object:Gem::Dependency
42
+ name: wwtd
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - ">="
46
+ - !ruby/object:Gem::Version
47
+ version: '0'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ">="
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
55
+ - !ruby/object:Gem::Dependency
56
+ name: bump
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - ">="
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - ">="
67
+ - !ruby/object:Gem::Version
68
+ version: '0'
69
+ - !ruby/object:Gem::Dependency
70
+ name: rake
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - ">="
74
+ - !ruby/object:Gem::Version
75
+ version: '0'
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - ">="
81
+ - !ruby/object:Gem::Version
82
+ version: '0'
83
+ - !ruby/object:Gem::Dependency
84
+ name: rspec
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - ">="
88
+ - !ruby/object:Gem::Version
89
+ version: '0'
90
+ type: :development
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - ">="
95
+ - !ruby/object:Gem::Version
96
+ version: '0'
97
+ - !ruby/object:Gem::Dependency
98
+ name: sqlite3
99
+ requirement: !ruby/object:Gem::Requirement
100
+ requirements:
101
+ - - ">="
102
+ - !ruby/object:Gem::Version
103
+ version: '0'
104
+ type: :development
105
+ prerelease: false
106
+ version_requirements: !ruby/object:Gem::Requirement
107
+ requirements:
108
+ - - ">="
109
+ - !ruby/object:Gem::Version
110
+ version: '0'
111
+ - !ruby/object:Gem::Dependency
112
+ name: minitest
113
+ requirement: !ruby/object:Gem::Requirement
114
+ requirements:
115
+ - - ">="
116
+ - !ruby/object:Gem::Version
117
+ version: '0'
118
+ type: :development
119
+ prerelease: false
120
+ version_requirements: !ruby/object:Gem::Requirement
121
+ requirements:
122
+ - - ">="
123
+ - !ruby/object:Gem::Version
124
+ version: '0'
41
125
  description:
42
126
  email: michael@grosser.it
43
127
  executables: