Skip to content
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

Conversation

yhirano55
Copy link
Contributor

Summary

@rails-bot
Copy link

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
Copy link
Member

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.

Copy link
Contributor Author

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.

Copy link
Contributor Author

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.

@yhirano55 yhirano55 force-pushed the modify_how_to_use_test_runner_in_contributing_guides branch from 7ae13bd to bf3c392 Compare April 3, 2018 03:07
* Since rails#20480, it come to be used `bin/test`.
* For newbies, bin/test is easier to understand than rake task.
@yhirano55 yhirano55 force-pushed the modify_how_to_use_test_runner_in_contributing_guides branch from bf3c392 to f9751ce Compare April 3, 2018 03:15
@y-yagi
Copy link
Member

y-yagi commented Apr 3, 2018

I think that should not recommend using bin/test yet.

For example, can not use bin/test to run an Active Job test and need to use rake test.
Also, individual tests are not guaranteed to work with bin/test. (Still, connection_handler_test.rb tests will not run for sure).
Therefore, I do not mind using people who are used to it, but I think that it will become a factor that confuses the beginner against it.

@yhirano55
Copy link
Contributor Author

@y-yagi Thanks for the comment. I'll close this PR. Thanks.

@yhirano55 yhirano55 closed this Apr 3, 2018
@yhirano55 yhirano55 deleted the modify_how_to_use_test_runner_in_contributing_guides branch April 3, 2018 03:38
composerinteralia added a commit to composerinteralia/rails that referenced this pull request Apr 21, 2018
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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants