Skip to content

Commit 07df6bb

Browse files
committed
Disable the test-unit gem autorunner.
For some reason the test-unit gem loads it's autorunner by default. Though the test-unit included with Ruby does not. The original code for loading test-unit pre-dates widespread usage of the test-unit gem. We took care of disabling the autorunner for Ruby 2.2+ since the test-unit gem is now required for Rails 3.2. For older Ruby versions we attempt to only load the `test/unit/assertions` module. When using the `test-unit` gem however, Rails will auto require it for us, which loads the main test-unit code, thus enabling the autorunner.
1 parent 64434ff commit 07df6bb

File tree

2 files changed

+4
-0
lines changed

2 files changed

+4
-0
lines changed

Changelog.md

+2
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@ Bug Fixes:
66
autoload does not find it in some environments. (Aaron Kromer, #1305)
77
* `be_routable` matcher now has the correct description. (Tony Ta, #1310)
88
* Fix dependency to allow Rails 4.2.x patches / pre-releases (Lucas Mazza, #1318)
9+
* Disable the `test-unit` gem's autorunner on projects running Rails < 4.1 and
10+
Ruby < 2.2 (Aaron Kromer, #1320)
911

1012
### 3.2.0 / 2015-02-03
1113
[Full Changelog](http://github.com/rspec/rspec-rails/compare/v3.1.0...v3.2.0)

lib/rspec/rails/adapters.rb

+2
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,8 @@ module Rails
6161
require 'rubysl-test-unit' if defined?(RUBY_ENGINE) && RUBY_ENGINE == 'rbx'
6262
require 'test/unit/assertions'
6363
end
64+
# Turn off test unit's auto runner for those using the gem
65+
Test::Unit::AutoRunner.need_auto_run = false if defined?(Test::Unit::AutoRunner)
6466
# Constant aliased to either Minitest or TestUnit, depending on what is
6567
# loaded.
6668
Assertions = Test::Unit::Assertions

0 commit comments

Comments
 (0)