aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport/test/test_case_test.rb
Commit message (Collapse)AuthorAgeFilesLines
* Use plain assert in assert_changes to avoid MT6 refutesGenadi Samokovarov2017-11-071-2/+3
| | | | | | | | | | | | | | | Seeing the previously issued PRs about it, we can avoid the `nil` comparisons that can happen in `assert_changes` by using plain `assert` calls. This is to avoid a deprecation warning about comparing `nil` values in `assert_equal` for Minitest 5 and a crash in Minitest 6. You can see the preparations done in [`assert_equal`][ae]. You can also see that [`assert`][a] does not care about `nil`s. [ae]: https://github.com/seattlerb/minitest/blob/ca6a71ca901016db09a5ad466b4adea4b52a504a/lib/minitest/assertions.rb#L159-L188 [a]: https://github.com/seattlerb/minitest/blob/ca6a71ca901016db09a5ad466b4adea4b52a504a/lib/minitest/assertions.rb#L131-L142
* removed unnecessary semicolonsShuhei Kitagawa2017-10-281-1/+1
|
* Suppress "unused variable" in Ruby 2.5Akira Matsuda & yui-knk2017-09-011-3/+4
|
* [Active Support] `rubocop -a --only Layout/EmptyLineAfterMagicComment`Koichi ITO2017-07-111-0/+1
|
* Use frozen-string-literal in ActiveSupportKir Shatrov2017-07-091-0/+1
|
* Revert "Merge pull request #29540 from kirs/rubocop-frozen-string"Matthew Draper2017-07-021-1/+0
| | | | | This reverts commit 3420a14590c0e6915d8b6c242887f74adb4120f9, reversing changes made to afb66a5a598ce4ac74ad84b125a5abf046dcf5aa.
* Enforce frozen string in RubocopKir Shatrov2017-07-011-0/+1
|
* Remove unused test classyuuji.yaginuma2017-05-261-3/+0
| | | | | | | | `AlsoDoingNothingTest` was added in cf9be89. It seems that it added to confirm that the test works in the child class of `ActiveSupport::TestCase`. But now basically use `ActiveSupport::TestCase` in test, so I think it is unnecessary.
* Privatize unneededly protected methods in Active Support testsAkira Matsuda2016-12-241-2/+2
|
* use `message` that specified in argument to error messageyuuji.yaginuma2016-08-311-0/+9
|
* use `inspect` for show `from` valueyuuji.yaginuma2016-08-291-0/+9
| | | | If `from` is nil, in order to avoid the blank is showed.
* applies new string literal convention in activesupport/testXavier Noria2016-08-061-29/+29
| | | | | The current code base is not uniform. After some discussion, we have chosen to go with double quotes by default.
* Introduce `assert_changes` and `assert_no_changes`Genadi Samokovarov2016-07-171-0/+106
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Those are assertions that I really do miss from the standard `ActiveSupport::TestCase`. Think of those as a more general version of `assert_difference` and `assert_no_difference` (those can be implemented by assert_changes, should this change be accepted). Why do we need those? They are useful when you want to check a side-effect of an operation. `assert_difference` do cover a really common case, but we `assert_changes` gives us more control. Having a global error flag? You can test it easily with `assert_changes`. In fact, you can be really specific about the initial state and the terminal one. ```ruby error = Error.new(:bad) assert_changes -> { Error.current }, from: nil, to: error do expected_bad_operation end ``` `assert_changes` follows `assert_difference` and a string can be given for evaluation as well. ```ruby error = Error.new(:bad) assert_changes 'Error.current', from: nil, to: error do expected_bad_operation end ``` Check out the test cases if you wanna see more examples. :beers:
* Make `assert_difference` return the result of the yielded block.Lucas Mazza2015-09-241-0/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | With this we can perform new assertions on the returned value without having to cache it with an outer variable or wrapping all subsequent assertions inside the `assert_difference` block. Before: ``` post = nil assert_difference -> { Post.count }, 1 do Post.create end assert_predicate post, :persisted? ``` Now: ``` post = assert_difference -> { Post.count } do Post.create end assert_predicate post, :persisted? ```
* Remove alias for `i_suck_and_my_tests_are_order_dependent`.Guo Xiang Tan2015-03-241-11/+0
|
* Change the default test order from `:sorted` to `:random`Rafael Mendonça França2015-01-041-13/+11
|
* Default to sorting user's test cases for nowGodfrey Chan2014-09-081-0/+47
| | | | | | | | | | | Goals: 1. Default to :random for newly generated applications 2. Default to :sorted for existing applications with a warning 3. Only show the warning once 4. Only show the warning if the app actually uses AS::TestCase Fixes #16769
* Move as/test_test to as/test_case_testZachary Scott2014-08-191-0/+174
|
* Remove active_support/testing/pending.rb was deprecated.kennyj2013-06-011-11/+0
|
* Updates to make rails 4 happy with minitest 5:Ryan Davis2013-05-061-110/+0
| | | | | | | | | | + 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.
* Fix failures in AS with minitest 4.7.4Carlos Antonio da Silva2013-05-011-0/+3
|
* Properly deprecate #pending from AS::TestCaseCarlos Antonio da Silva2012-11-181-0/+6
| | | | Check https://github.com/rails/rails/pull/4575#issuecomment-5765575.
* Make the tests pass with minitest 4.2Rafael Mendonça França2012-11-051-0/+3
|
* Exceptions like Interrupt should not be rescued.James Mead2012-05-281-8/+50
| | | | | | | | | | | | | | | | | | | | | | | Neither Test::Unit nor MiniTest rescue exceptions like Interrupt or NoMemoryError, but ActiveSupport::Testing::SetupAndTeardown#run which overrides MiniTest::Unit::TestCase#run rescues them. Rescuing an Interrupt exception is annoying, because it means when you are running a lot of tests e.g. when running one of the rake test tasks, you cannot break out using ctrl-C. Rescuing exceptions like NoMemoryError is foolish, because the most sensible thing to happen is for the process to terminate as soon as possible. This solution probably needs some finessing e.g. I'm not clear whether the assumption is that only MiniTest is supported. Also early versions of MiniTest did not have this behaviour. However, hopefully it's a start. Integrating with Test::Unit & MiniTest has always been a pain. It would be great if both of them provided sensible extension points for the kind of things that both Rails and Mocha want to do.
* make sure the test case name is nilAaron Patterson2012-01-061-0/+8
|
* No need to check if MiniTest::Assertions is definedRafael Mendonça França2012-01-061-32/+30
|
* fixing test case test on 1.9.3devAaron Patterson2011-03-011-0/+4
|
* calling correct method on minitest for test name when teardown callback failsAaron Patterson2010-10-041-0/+19
|
* [#5406 state:resolved] calling the correct method on minitest to obtain the ↵Aaron Patterson2010-10-041-0/+38
test name