aboutsummaryrefslogtreecommitdiffstats
path: root/railties/test/application/test_runner_test.rb
Commit message (Collapse)AuthorAgeFilesLines
* reestablish previous connection after creating all databasesAaron Patterson2016-02-231-0/+13
| | | | | | creating all databases mutates the connection pool. This patch restores the connection pool to the connection spec established before creating all databases. Fixes #23279
* make sure `rake test` respects TESTOPTSAaron Patterson2016-02-221-0/+13
| | | | | We should be able to pass options to minitest via TESTOPTS environment variable
* test runner, relay minitest information about the error location.Yves Senn2016-02-151-1/+1
| | | | | This is a follow-up to ea70c29 to bring back the assertion error location information provided by minitest.
* Revert "Prefer Minitest's location for test failures."Yves Senn2016-02-151-1/+1
| | | | | | | | | | | | | | | | | | | | This reverts commit 0db310586ac3e15be95d2ef27ff40cfa24c05c10. Closes #23686. Conflicts: railties/test/application/test_runner_test.rb It's possible that the `result.location` returned by minitest is outside the test file itself. For example in the case of mocha. This resulted in bad rerun snipptets: ``` bin/rails test app/models/deliveries/delivery.rb:103 ``` Let's always use the first line of the failed test-case in our rerun snippet. We can display the line number of the assertion error elsewhere.
* Fix mixing line filters with Minitest's -n filter.Kasper Timm Hansen2016-02-051-0/+24
| | | | | | | | | | | Previous commit accidentally broke mixing line filters with string -n filter. Fix by checking if it is a string and returning it. We also need to ensure the -n filter carry forward into any other composite filters. Fix by letting the named filter be extractable, so we'll keep this for the next runnable's run.
* Fix model test path typo uncovered in previous commit.Kasper Timm Hansen2016-02-031-1/+1
| | | | | | | | | | | | Because of the expanding whitelist for test filters, this test ended up running the tests on lines 4 and 9 in the post test even though the path wasn't right. Happened incidentally because the same line numbers were used in both account and post test. Add the .rb line so the file is required correctly and the filters are applied.
* Fix line filters running tests from multiple runnables.Kasper Timm Hansen2016-02-031-0/+24
| | | | | | | | | | | | | | | | | | | | | | | | `derive_regexp` was written with the assumption that we were run from a blank slate — that if the filter didn't match we might as well return it because it was nil. This isn't the case because minitest calls `run` on every runnable. Which is any subclass of Minitest::Runnable, such as ActiveSupport::TestCase, ActionDispatch::IntegrationTest as well as any inheriting from those. Thus after the first `run` we'd have put in a composite filter in `options[:filter]` making the next `run` create a linked list when it failed to match the regexp and put the composite filter as the head. Every runnable would accumulate more and more of the same filters, which effectively acted like an expanding whitelist and we ran tests from other runnables. Clog the accumulation by returning nil if there's no filter to derive a regexp from. Note: we pass a seed in the tests because Minitest shuffles the runnables to ensure the whitelist is expanded enough that the failure is triggered.
* Be consistent in testing outputs from railties test and use /bin/rails ↵Vipul A M2016-01-241-2/+3
| | | | | | everywhere(the default behaviour now) instead of mix of /bin/rake /bin/rails everywhere [Ryo Hashimoto & Vipul A M]
* Don't run all tests when files end in a colon.Kasper Timm Hansen2016-01-181-8/+0
| | | | | | | | | | | | | | If running `bin/rails t test/models/bunny_test.rb:` we'd implicitly run all the tests in the bunny test. I now highly doubt that people would ever put in a line filter without a line *and* want that to mean run all tests in that file. Instead, change regex to require a line digit after the colon, so runs without a line at the end would fail to require the test file. This also has the side benefit of breaking requiring a file with many colons: `bin/rails t test/models/bunny_test.rb:::::::::::::4` Think this means I've had enough colonoscopy to last me through the year :)
* bring back `TEST` env for `rake test`.Yves Senn2016-01-121-0/+11
| | | | | | | Closes #23027. This does not restore complete backwards compatibility. It simply passes the contets of the `TEST` env to the new runner.
* Added multiple line filters support for test runnerSiva Gollapalli2016-01-101-0/+78
|
* make generated controller test work correctlyyuuji.yaginuma2016-01-061-0/+9
| | | | | | | Since the `#file_name` that not consideration for the namespace, if generate a controller with a namespace, not the correct url helper generation, it had become an error to run the test. Modified to generate the correct url helper, even if it is produced a namespace with controller.
* display detailed information in inline reportingyuuji.yaginuma2015-12-211-1/+2
| | | | | | | | | | | | | | | | | | | | | The errors message only was not displayed, as if it did not use the inline reporting, modified to also information the method name and the like in error are displayed. ``` # before Failed assertion, no message given. bin/rails test test/models/user_test.rb:5 ``` ``` # after Failure: UserTest#test_the_truth: Failed assertion, no message given. bin/rails test test/models/user_test.rb:5 ```
* Prefer Minitest's location for test failures.Kasper Timm Hansen2015-11-121-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | When running tests, the Rails test runner would report the start of the test method as the test failure. For this test: ```ruby 1 require 'test_helper 2 3 class BunnyTest < ActiveSupport::TestCase 4 test "something failing" do 5 assert false, 'This failed' 6 end 7 end ``` The runner outputs 5 instead of 4: ``` ............................................F This failed bin/rails test test/models/bunny_test.rb:5 ........ ```
* Refactor create_test_file to take a pass option.Kasper Timm Hansen2015-10-071-31/+7
| | | | Lets us cut the verbose and straight up duplicated setup in 3 tests down to one line.
* Hide Minitest's aggregated results if outputting inline.Kasper Timm Hansen2015-10-071-0/+15
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | We'd see the failures and errors reported after the run, which is needless, when we've already reported them. Turns: ``` .......................................S....................F This failed bin/rails test test/models/bunny_test.rb:14 .... Finished in 0.100886s, 1020.9583 runs/s, 1001.1338 assertions/s. 2) Failure: BunnyTest#test_something_failing [/Users/kasperhansen/Documents/code/collection_caching_test/test/models/bunny_test.rb:15]: This failed 103 runs, 101 assertions, 1 failures, 0 errors, 1 skips You have skipped tests. Run with --verbose for details. ``` Into: ``` ...................S.......................................F This failed bin/rails test test/models/bunny_test.rb:14 ...................... Finished in 0.069910s, 1473.3225 runs/s, 1444.7143 assertions/s. 103 runs, 101 assertions, 1 failures, 0 errors, 1 skips ```
* Add fail fast to test runner.Kasper Timm Hansen2015-09-291-0/+15
| | | | | Passing `--fail-fast` to the test runner will now abort the test run on the first failure. The run continues on any unexpected errors.
* Add inline failure reporting to test runner.Kasper Timm Hansen2015-09-281-0/+15
| | | | | | | | | Any failures or errors will be reported inline during the run by default. Skipped tests will be reported if run in verbose mode. Any result is output with failure messages and a rerun snippet for that test. Rerun snippets won't be output after a run, unless `--defer-output` is passed.
* raise LoadError when a non-existent file or directory is specified to the ↵yuuji.yaginuma2015-09-071-0/+5
| | | | | | | | test runner Currently, if a file or directory that does not exist was specified in the test runner, that argument is ignored. This commit has been modified to cause an error if there is no file or directory.
* tests, railties tests should use `bin/` executables when possible.Yves Senn2015-06-301-1/+1
| | | | | We recommend using the `bin/` executables in our docs and guides. Let's make sure that our tests execute the same code path.
* Improve test runner's Minitest integration.Kasper Timm Hansen2015-06-041-25/+140
| | | | | | | | | | | This also adds free mix and matching of directories, files and lines filters. Like so: bin/rails test models/post_test.rb test/integration models/person_test.rb:26 You can also mix in a traditional Minitest filter: bin/rails test test/integration -n /check_it_out/
* `-p`, `--pattern` to run tests using a pattern.Yves Senn2015-03-181-2/+1
|
* use `bin/rails t` runner in `test_runner_test.rb`.Yves Senn2015-03-181-24/+18
|
* tests, use `capture` instead of custom `redirect_stderr` helper.Yves Senn2015-01-301-12/+2
|
* Add `test:jobs` taskyuuji.yaginuma2014-09-151-3/+14
|
* Updates to make rails 4 happy with minitest 5:Ryan Davis2013-05-061-10/+10
| | | | | | | | | | + Namespace changes, overhaul of runners. + Internal ivar name changes - Removed a logger globally applied to tests that spew everywhere?!? + Override Minitest#__run to sort tests by name. + Reworked testing isolation to work with the new cleaner architecture. - Removed a bunch of tests that just test minitest straight up. I think these changes were all merged to minitest 4 a long time ago. - Minor report output differences.
* add integration test for shorthand rake testsAaron Patterson2013-04-051-0/+7
|
* extract test info from the command line and set up the test taskAaron Patterson2013-04-051-1/+22
|
* removing `rails test`, updating docs to show how to use `rake test`Aaron Patterson2013-04-051-6/+0
|
* do not blow away the test database on every runAaron Patterson2013-04-051-10/+0
|
* switch the testing tests to use rakeAaron Patterson2013-04-031-20/+23
|
* apps that depend on active record should load fixturesAaron Patterson2013-04-031-7/+0
|
* Replace assert_(no_)match args from regexps to strings to remove warningsCarlos Antonio da Silva2013-03-111-40/+40
| | | | | | Using regexps as arguments without parentheses end up raising: warning: ambiguous first argument; put parentheses or even spaces
* Make sure that the test case is run under test envPrem Sichanugrist2013-03-111-1/+17
| | | | | | * Unset $RAILS_ENV that got set by abstract_unit to trigger the default. * split out environment setting since Ruby 1.9.3 doesn't support inline ENV setting.
* Fix test failure introduced in 3ed41e57Prem Sichanugrist2013-03-111-5/+3
| | | | I forgot to run the test suit after changing the task name. :bomb:
* Make sure that `rails test` load test in test envPrem Sichanugrist2013-03-091-1/+44
|
* Improve wording for rails test commandDalibor Nasevic2013-03-091-8/+8
|
* Load fixtures only when running suites, or `-f`Prem Sichanugrist2013-03-091-0/+51
| | | | | | * `rails test -f` will run the test suites with all fixtures loaded * New application will now generated without `fixtures :all` line enabled by default.
* Add support for MiniTest flags in TestRunnerPrem Sichanugrist2013-03-091-0/+21
| | | | | Any flags that got set will be passed through to MiniTest::Unit.runner, such as `-n`, `-s-, and `-v`.
* Add `rails test` command to run the test suitePrem Sichanugrist and Chris Toomey2013-03-091-0/+183
To run the whole test suite: $ rails test To run the test file(s): $ rails test test/unit/foo_test.rb [test/unit/bar_test.rb ...] To run the test suite $ rails test [models,helpers,units,controllers,mailers,...] For more information, see `rails test --help`. This command will eventually replacing `rake test:*`, and `rake test` command will actually invoking `rails test` instead.