mirror of
https://github.com/heartcombo/devise.git
synced 2022-11-09 12:18:31 -05:00
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: https://github.com/rails/rails/pull/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)
This commit is contained in:
parent
e72839f4bc
commit
2dd322579f
2 changed files with 12 additions and 8 deletions
|
@ -159,12 +159,12 @@ bin/test
|
||||||
|
|
||||||
* Running tests for an specific file:
|
* Running tests for an specific file:
|
||||||
```bash
|
```bash
|
||||||
ruby -Itest test/models/trackable_test.rb
|
bin/test test/models/trackable_test.rb
|
||||||
```
|
```
|
||||||
|
|
||||||
* Running a specific test given a regex:
|
* Running a specific test given a regex:
|
||||||
```bash
|
```bash
|
||||||
ruby -Itest test/models/trackable_test.rb --name /authentication/
|
bin/test test/models/trackable_test.rb:16
|
||||||
```
|
```
|
||||||
|
|
||||||
## Starting with Rails?
|
## Starting with Rails?
|
||||||
|
|
16
bin/test
16
bin/test
|
@ -1,13 +1,17 @@
|
||||||
#!/usr/bin/env ruby
|
#!/usr/bin/env ruby
|
||||||
$: << File.expand_path(File.expand_path('../../test', __FILE__))
|
$: << File.expand_path(File.expand_path('../../test', __FILE__))
|
||||||
|
|
||||||
require 'bundler/setup'
|
# Remove this begin/rescue once Rails 4 support is removed.
|
||||||
begin
|
begin
|
||||||
require 'rails/test_unit/minitest_plugin'
|
require 'bundler/setup'
|
||||||
|
require 'rails/test_unit/runner'
|
||||||
|
require 'rails/test_unit/reporter'
|
||||||
|
require 'rails/test_unit/line_filtering'
|
||||||
|
|
||||||
|
Rails::TestUnitReporter.executable = 'bin/test'
|
||||||
|
|
||||||
|
Rails::TestUnit::Runner.parse_options(ARGV)
|
||||||
|
Rails::TestUnit::Runner.run(ARGV)
|
||||||
rescue LoadError
|
rescue LoadError
|
||||||
exec 'rake'
|
exec 'rake'
|
||||||
end
|
end
|
||||||
|
|
||||||
Rails::TestUnitReporter.executable = 'bin/test'
|
|
||||||
|
|
||||||
exit Minitest.run(ARGV)
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue