-
Notifications
You must be signed in to change notification settings - Fork 21.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Modify how to use test runner in contributing guides [ci skip] #32426
Modify how to use test runner in contributing guides [ci skip] #32426
Conversation
r? @kaspth (@rails-bot has picked a reviewer for you, use r? to override) |
``` | ||
|
||
To run a single test against all adapters, use: | ||
|
||
```bash | ||
$ bundle exec rake TEST=test/cases/associations/has_many_associations_test.rb | ||
$ bin/test test/cases/associations/has_many_associations_test.rb |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
At least this change is not true.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It seems bin/test
cannot run with all adapters, doesn't it? I'll restore this.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
According to guides:
To run a single test against all adapters, use:
$ bundle exec rake TEST=test/cases/associations/has_many_associations_test.rb
But rake -T
:
% bundle exec rake -T
rake default # Run mysql2, sqlite, and postgresql tests by default
It might be not "all adapters" but "mysql2, sqlite, and postgresql adapters" is right.
7ae13bd
to
bf3c392
Compare
* Since rails#20480, it come to be used `bin/test`. * For newbies, bin/test is easier to understand than rake task.
bf3c392
to
f9751ce
Compare
I think that should not recommend using For example, can not use |
@y-yagi Thanks for the comment. I'll close this PR. Thanks. |
At the moment these two ActiveRecord tests pass with `rake test:sqlite3`, but fail with `ARCONN=sqlite3 bin/test`. `Rails.root` is defined when running `bin/test`, but not when running the rake task. When `Rails.root` is defined, `config[:database]` will look something like `vagrant/rails/activerecord/db/primary.sqlite3` instead of just `db/primary.sqlite3`. (See https://github.com/rails/rails/blob/00caf95e14b90782ab17fbd6d2b930844df99980/activerecord/lib/active_record/connection_adapters/sqlite3_adapter.rb#L27) Relaxing `assert_equal` to `assert_match` will allow these tests to pass regardless of how they are run. I do have a question why we need both ways to run tests. I have been using `bin/test` lately, but I see from rails#32426 that this is not the preferred method.
Summary
bin/test
#20480, it come to be usedbin/test
.