forking_test_runner 0.4.1 → 0.4.2

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: 64128cc7f160f06146df5f574db87e9fbc7c76ea
4
- data.tar.gz: 194fa97dea7415df5da9c0421667c2822834af1c
3
+ metadata.gz: f225f138349841629ffb3f3ed73ea90d2f014a7c
4
+ data.tar.gz: 17239acf778f70cca023d8962d415bbc5b53953d
5
5
  SHA512:
6
- metadata.gz: 4fd4aac197073e9afc9c12b7010771b3333f0f910b8663baf13f1656bc7b685bacbc44ef3296e08077e175f1bbd8873a290587bcd3c9ba1c196bff112c77d391
7
- data.tar.gz: 7bedeec8f452e86b56528541a966a2be80b05deeb6ebf76c3d781077be1f7b1679144ae53cba04a52ee719e1097f7af57dd58d99e9552472e21ef70fe5ec5632
6
+ metadata.gz: adb87e6d6591baff9be1f11386ae3b9281dfc56745305be229036f0dfe404f5cb3159ac2563a9dc00c1ad0dc7f68ed41476cb8cb5d389637efeef01dc7cefa6b
7
+ data.tar.gz: b47bd2d9f2ea6d706d18a1f7ac08d077ab6a95791cfe5069b5907b2b812f36bb6878bd550bea98d744c4be17a17cb9817c3df59e2beb2f9a64bed2eba7f969d7
@@ -6,6 +6,7 @@ module ForkingTestRunner
6
6
  class << self
7
7
  def cli(argv)
8
8
  @rspec = delete_argv("--rspec", argv, arg: false)
9
+ @no_fixtures = delete_argv("--no-fixtures", argv, arg: false)
9
10
 
10
11
  disable_test_autorun
11
12
  load_test_env(delete_argv("--helper", argv))
@@ -109,7 +110,7 @@ module ForkingTestRunner
109
110
  # This forces Rails to load all fixtures, then prevents it from
110
111
  # "deleting and re-inserting all fixtures" when a new connection is used (forked).
111
112
  def preload_fixtures
112
- return if @preloaded
113
+ return if @preloaded || @no_fixtures
113
114
  @preloaded = true
114
115
 
115
116
  fixtures = (ActiveSupport::VERSION::MAJOR == 3 ? ActiveRecord::Fixtures : ActiveRecord::FixtureSet)
@@ -139,12 +140,16 @@ module ForkingTestRunner
139
140
  end
140
141
 
141
142
  def run_test(file)
142
- preload_fixtures
143
- ActiveRecord::Base.connection.disconnect!
143
+ if ar?
144
+ preload_fixtures
145
+ ActiveRecord::Base.connection.disconnect!
146
+ end
144
147
  change_program_name_to file do
145
148
  child = fork do
146
- key = (ActiveRecord::VERSION::STRING >= "4.1.0" ? :test : "test")
147
- ActiveRecord::Base.establish_connection key
149
+ if ar?
150
+ key = (ActiveRecord::VERSION::STRING >= "4.1.0" ? :test : "test")
151
+ ActiveRecord::Base.establish_connection key
152
+ end
148
153
  enable_test_autorun(file)
149
154
  end
150
155
  Process.wait(child)
@@ -187,6 +192,10 @@ module ForkingTestRunner
187
192
  end
188
193
  end
189
194
 
195
+ def ar?
196
+ defined?(ActiveRecord::Base)
197
+ end
198
+
190
199
  def toggle_test_autorun(value, file=nil)
191
200
  if @rspec
192
201
  if value
@@ -1,3 +1,3 @@
1
1
  module ForkingTestRunner
2
- VERSION = "0.4.1"
2
+ VERSION = "0.4.2"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: forking_test_runner
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.1
4
+ version: 0.4.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Michael Grosser