aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport/test/test_case_test.rb
Commit message (Collapse)AuthorAgeFilesLines
* 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