Skip to content

Commit 2dd3225

Browse files
committed
Fix bin/test to use Rails::TestUnit
The command bin/test stop running single tests once Devise started to support Rails 5.2. The problem is because we used `rails/test_unit/minitest_plugin` and this file was moved to another place. See: rails/rails#29572 I'm not sure if we should require the `minitest-plugin` directly from Rails like we were doing, I tried it and it didn't work. So I'm changing this `bin/test` completely based on how Rails does that [here](https://github.com/rails/rails/blob/master/tools/test.rb)
1 parent e72839f commit 2dd3225

File tree

2 files changed

+12
-8
lines changed

2 files changed

+12
-8
lines changed

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -159,12 +159,12 @@ bin/test
159159

160160
* Running tests for an specific file:
161161
```bash
162-
ruby -Itest test/models/trackable_test.rb
162+
bin/test test/models/trackable_test.rb
163163
```
164164

165165
* Running a specific test given a regex:
166166
```bash
167-
ruby -Itest test/models/trackable_test.rb --name /authentication/
167+
bin/test test/models/trackable_test.rb:16
168168
```
169169

170170
## Starting with Rails?

bin/test

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,17 @@
11
#!/usr/bin/env ruby
22
$: << File.expand_path(File.expand_path('../../test', __FILE__))
33

4-
require 'bundler/setup'
4+
# Remove this begin/rescue once Rails 4 support is removed.
55
begin
6-
require 'rails/test_unit/minitest_plugin'
6+
require 'bundler/setup'
7+
require 'rails/test_unit/runner'
8+
require 'rails/test_unit/reporter'
9+
require 'rails/test_unit/line_filtering'
10+
11+
Rails::TestUnitReporter.executable = 'bin/test'
12+
13+
Rails::TestUnit::Runner.parse_options(ARGV)
14+
Rails::TestUnit::Runner.run(ARGV)
715
rescue LoadError
816
exec 'rake'
917
end
10-
11-
Rails::TestUnitReporter.executable = 'bin/test'
12-
13-
exit Minitest.run(ARGV)

0 commit comments

Comments
 (0)