aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport/lib/active_support/testing
Commit message (Collapse)AuthorAgeFilesLines
* make sure exceptions are marshalable when returning test resultsAaron Patterson2015-09-301-1/+17
| | | | | this should fix the error where isolation tests raise an exception and we just get a marshal error
* Improve readability of docs by using code tag [ci skip]Prakash Laxkar2015-09-291-1/+1
|
* Make `assert_difference` return the result of the yielded block.Lucas Mazza2015-09-241-1/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | 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? ```
* Cleaned up generators tests using internal assertion helperRonak Jangir2015-08-201-2/+4
|
* Replacing lambda with proc getting argument error because of it.Ronak Jangir2015-08-171-1/+1
|
* Added helper methods to stub any instanceRonak Jangir2015-08-131-1/+5
|
* Add multiple expected calls to assert_called_with.Kasper Timm Hansen2015-07-101-1/+6
|
* Add method call assertions for internal use.Kasper Timm Hansen2015-07-081-0/+30
| | | | | Add `assert_called` and `assert_not_called` to boil down the boilerplate we need to write to assert methods are called certain number of times.
* inline test runner check into `as/testing/autorun.rb`.Yves Senn2015-06-111-1/+8
| | | | | This makes it possible to easily get the runner working with existing setups that rely on `active_support/testing/autorun.rb`.
* Merge pull request #19571 from kaspth/improve-runner-integrationYves Senn2015-06-081-0/+54
|\ | | | | | | Improve Test Runner's Minitest integration.
| * Improve test runner's Minitest integration.Kasper Timm Hansen2015-06-041-0/+54
| | | | | | | | | | | | | | | | | | | | | | 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/
* | A few documentation tweaks [ci skip]Robin Dupret2015-06-071-1/+1
|/ | | | [Robin Dupret & Shunsuke Aida]
* Remove `assigns` and `assert_template`.Guo Xiang Tan2015-05-301-1/+1
|
* use keyword arguments in HTTP request methods of assert_difference example ↵yuuji.yaginuma2015-05-241-9/+9
| | | | [ci skip]
* MRI compatible code for ActiveSupport::Testing::Isolation::SubprocessAlexey Gaziev2015-04-191-4/+4
|
* Small doc fix. [CI SKIP]Guo Xiang Tan2015-03-241-1/+1
|
* add `DateTime.now` to list of `TimeHelpers#travel_to` stubbing [ci skip]yuuji.yaginuma2015-03-121-9/+11
|
* Merge pull request #18526 from vipulnsward/add-silence-streamRafael Mendonça França2015-02-051-0/+42
|\ | | | | Extracted silence_stream method to new module in activesupport/testing
| * - Extracted silence_stream method to new module in activesupport/testing.Vipul A M2015-01-201-0/+42
| | | | | | | | | | | | | | | | | | | | | | | | - Added include for the same in ActiveSupport::Test. - Removed occurrences of silence_stream being used elsewhere. - Reordered activesupport testcase requires alphabetically. - Removed require of silence stream from test_case - Moved quietly method to stream helper - Moved capture output to stream helper module and setup requires for the same elsewhere
* | Change AS::Testing::TimeHelpers#travel_to to also stub DateTime.nowYuki Nishijima2015-02-031-0/+1
| |
* | introduce `ActiveSupport::Testing::FileFixtures`.Yves Senn2015-01-281-0/+34
|/ | | | | | It's a thin layer to provide easy access to sample files throughout test-cases. This adds the directory `test/fixtures/files` to newly generated applications.
* Better fork detection in ActiveSupport::Testing::Isolationdeepj2015-01-101-3/+1
| | | | | Process.respond_to?(:fork) returns false if fork is not available. More on http://www.ruby-doc.org/core-2.0.0/Process.html#method-c-fork
* Pass symbol as an argument instead of a blockErik Michaels-Ober2014-11-291-1/+1
|
* Merge pull request #17302 from ↵Rafael Mendonça França2014-10-181-2/+2
| | | | | | claudiob/replace-slower-block-call-with-faster-yield Replace (slower) block.call with (faster) yield
* Revert "Replace (slower) block.call with (faster) yield"Zachary Scott2014-10-181-2/+2
| | | | This reverts commit 0ab075e75f58bf403f7ebe20546c7005f35db1f6.
* Replace (slower) block.call with (faster) yieldclaudiob2014-10-181-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Performance optimization: `yield` with an implicit `block` is faster than `block.call`. See http://youtu.be/fGFM_UrSp70?t=10m35s and the following benchmark: ```ruby require 'benchmark/ips' def fast yield end def slow(&block) block.call end Benchmark.ips do |x| x.report('fast') { fast{} } x.report('slow') { slow{} } end # => fast 154095 i/100ms # => slow 71454 i/100ms # => # => fast 7511067.8 (±5.0%) i/s - 37445085 in 4.999660s # => slow 1227576.9 (±6.8%) i/s - 6145044 in 5.028356s ```
* Use `safe_constantize`.Guo Xiang Tan2014-09-021-5/+1
| | | | Fixes https://github.com/rails/rails/issues/9933.
* Fix rounding errors with #travel_to by resetting the usec on any passed time ↵David Heinemeier Hansson2014-08-171-1/+5
| | | | to zero, so we only travel with per-second precision, not anything deeper than that.
* Prefer to pass block when logging.Guo Xiang Tan2014-07-181-1/+1
| | | | | | | | The Logger by default includes a guard which checks for the logging level. By removing the custom logging guards, we can decouple the logging guard from the logging action to be done. This also follows the good practice listed on http://guides.rubyonrails.org/debugging_rails_applications.html#impact-of-logs-on-performance.
* Make the isolated tests run on JRubyRobin Dupret2014-06-211-6/+16
| | | | | | | | | | | | | | As there is no forking on JRuby, we need to spawn sub-processes to make the tests run in isolation. Previously, we were defining globally env variables and running the test file through backticks and delete these variables once the test ran. Now, we simply rely on IO.popen as this is cross-platform and the env variables are available during the child-process execution only so there are no race conditions. [Ben Browning & Robin Dupret]
* [ci skip] Correct output of #assert_notAkshay Vishnoi2014-06-121-1/+1
|
* remove deprecated code. Rely on `describe` provided by minitestAaron Patterson2014-06-101-24/+0
|
* use method_defined? to check whether or not a method is definedAaron Patterson2014-03-121-1/+1
|
* travel_to travels back and re-raises if the block raisesXavier Noria2014-02-181-3/+6
|
* time helpers honor the application time zone when passed a dateXavier Noria2014-02-181-4/+19
| | | | | | | | | | | | | | | | | Rails applications are expected to be always aware of the application time zone. To be consistent with that contract, we have to assume that a bare date passed to time helpers is a date in the application time zone, not in the system time zone. The system time zone is irrelevant, we should totally ignore it. For example, travel_to user.birth_date + 40.years should make that user be 40th years old regardless of the system time zone. Without this patch that may not be true.
* Improve documentation [ci skip]Rafael Mendonça França2014-01-301-3/+4
|
* Remove automatic removal of Date/Time stubs after each test caseRafael Mendonça França2014-01-301-9/+2
| | | | | | This behavior is only work out-of-box with minitest and also add a downside to run after each test case, even if we don't used the travel or travel_to methods
* Add `travel_back` to remove stubs from `travel` and `travel_to`Rafael Mendonça França2014-01-301-3/+14
|
* Use each_valueRafael Mendonça França2014-01-291-1/+1
|
* Store the singleton_class in a local variableRafael Mendonça França2014-01-291-3/+4
|
* Change the class and method visibilityRafael Mendonça França2014-01-291-9/+13
|
* Use instance method instead of before hookRafael Mendonça França2014-01-291-9/+8
|
* Alias the original method first to avoid warningsRafael Mendonça França2014-01-291-2/+7
|
* Implement a simple stub feature to use in the Time travel helpersRafael Mendonça França2014-01-291-4/+44
|
* set encoding to binmode for pipeAnna Carey2014-01-171-0/+2
|
* Merge pull request #13260 from arunagw/using-parallelize_meAaron Patterson2013-12-101-6/+3
|\ | | | | Using parallelize_me! to parallelize isolated test
| * Using parallelize_me! to parallelize isolated testArun Agrawal2013-12-101-6/+3
| | | | | | | | | | As ParallelEach is no more available related commit ec00442c10cb90796909e876fb1cc557ed7518bd
* | make `collect_deprecations` available.Yves Senn2013-12-101-11/+10
|/ | | | | | | | | | There are circumstances where the capabilities of `assert_deprecated` and `assert_not_deprecated` are not enough. For example if a ccertain call-path raises two deprecations but should only raise a single one. This module is still :nodoc and intented for internal use. /cc @rafaelfranca
* Minitest upgrade broke buildArun Agrawal2013-12-061-1/+1
| | | | | | https://github.com/seattlerb/minitest/commit/34760e3b268bc1bb4ac5fe1a44ef1ff0a2f9bd4d This PR should fix build
* Deprecate ActiveSupport::TestCase.describeMike Moore2013-11-271-5/+12
| | | | | Provide message to define ActiveSupport::TestCase.name instead. Allow calling describe with a block, which Minitest::Spec does.