aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport/lib/active_support/testing
Commit message (Collapse)AuthorAgeFilesLines
* 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.
* doc `travel` and `travel_to` stubs are removed in teardown. [ci skip]Yves Senn2013-11-211-4/+4
|
* Add `#travel` and `#travel_to` to AS::TestCasePrem Sichanugrist2013-11-201-0/+55
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Add `ActiveSupport::Testing::TimeHelpers#travel` and `#travel_to`. These methods change current time to the given time or time difference by stubbing `Time.now` and `Date.today` to return the time or date after the difference calculation, or the time or date that got passed into the method respectively. These methods also accept a block, which will return current time back to its original state at the end of the block. Example for `#travel`: Time.now # => 2013-11-09 15:34:49 -05:00 travel 1.day Time.now # => 2013-11-10 15:34:49 -05:00 Date.today # => Sun, 10 Nov 2013 Example for `#travel_to`: Time.now # => 2013-11-09 15:34:49 -05:00 travel_to Time.new(2004, 11, 24, 01, 04, 44) Time.now # => 2004-11-24 01:04:44 -05:00 Date.today # => Wed, 24 Nov 2004 Both of these methods also accept a block, which will return the current time back to its original state at the end of the block: Time.now # => 2013-11-09 15:34:49 -05:00 travel 1.day do User.create.created_at # => Sun, 10 Nov 2013 15:34:49 EST -05:00 end travel_to Time.new(2004, 11, 24, 01, 04, 44) do User.create.created_at # => Wed, 24 Nov 2004 01:04:44 EST -05:00 end Time.now # => 2013-11-09 15:34:49 -05:00 This module is included in `ActiveSupport::TestCase` automatically.
* Fix ActiveSupport::Testing::Isolation on jrubyAlex Tambellini2013-08-021-48/+4
| | | | | | | | | | | | | | | | | | Hopefully the first of many related to #11700. With these changes the railties tests wont 100% pass but at least they will run and show the errors. The first problem was the @method_name variable was never set. This was causing ENV["ISOLATION_TEST"] to always be nil which would cause the test output to never be written to the tempfile. The second problem was that an invalid -t option was being passed to minitest and minitest was erroring out. The third problem was the run method needs to always return an instance of the test class it is trying to isolate. We were returning a ProxyTestResult instead.
* remove deprecated `assert_present` and `assert_blank`.Yves Senn2013-07-011-30/+0
|
* add documentation for `ActiveSupport::Testing::SetupAndTeardown`.Yves Senn2013-06-191-2/+17
|
* better documentation for `AS::Testing::Declarative#test`. [ci skip]Yves Senn2013-06-191-3/+6
|
* Remove active_support/testing/pending.rb was deprecated.kennyj2013-06-011-14/+0
|
* oops. I should have only required minitest, not minitets/autorun. muscle memory.Ryan Davis2013-05-091-1/+1
|
* Updates to make rails 4 happy with minitest 5:Ryan Davis2013-05-063-14/+9
| | | | | | | | | | + 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.
* Work around change in how MiniTest detects SIGINFOJon Leighton2013-05-031-0/+4
| | | | | | | | | | | | | | | | | MiniTest 4.7.3 detects the presence of SIGINFO and stores the answer in a constant. It seems that MiniTest 4.7.4 changes this, and instead relies on an info_signal method being implemented on the runner object. In ActiveSupport::Testing::Isolation, we use ProxyTestResult to stand in for the runner object. This object implements `method_missing`, and as such its #info_signal method has a truthy return value. This results in MiniTest trying to install the SIGINFO handler on platforms where SIGINFO does not exists. To fix, I am simply defining an explicit ProxyTestResult#info_signal method.
* determine_constant_from_test_name does not swallow NoMethodErrors [Yves Senn]Xavier Noria2013-03-281-0/+2
|
* Bump up minitest dependency and remove our own reinvented version of ↵Akira Matsuda2013-02-191-37/+1
| | | | ParallelEach
* 'minitest/parallel_each' might not always be availableAkira Matsuda + Koichi Sasada2013-01-291-1/+4
|
* Needs to explicitly require 'minitest/parallel_each'Akira Matsuda + Koichi Sasada2013-01-291-0/+2
| | | | Minitest has changed to require this since https://github.com/seattlerb/minitest/commit/728054b
* The test setup is not threadsafe. Wrap in a mutex.Jon Leighton2013-01-181-3/+7
|
* MiniTest already defines a ParallelEach classJon Leighton2013-01-181-23/+27
| | | | | This may or may not fix the intermittent railties failures we've been seeing on the CI with Ruby 2.0. We'll see.
* extract PerformanceTest into rails-performance_tests gemYves Senn2013-01-104-672/+0
|
* deprecate `assert_blank` and `assert_present`.Yves Senn2013-01-051-0/+2
| | | | | They don't add any benefits over `assert object.blank?` and `assert object.present?`
* added marshal_load and marshal_dump for ProxyTestResult. Behavior of ↵SHIBATA Hiroshi2013-01-051-2/+10
| | | | method_missing with Marshal.dump and Marshal.load is changing in ruby 2.0.0 later.
* Add active_support/testing/autorunRafael Mendonça França2012-12-311-0/+5
| | | | | minitest/autorun load minitest/spec polluting the global namespace with the DSL that we don't want on Rails
* Revert "minitest provides "it" and "describe""Rafael Mendonça França2012-12-311-0/+40
| | | | | | | | | | This reverts commit 22bc12ec374b8bdeb3818ca0a3eb787dd3ce39d8. REASON: We will remove the MiniTest::Spec from Rails and we need these methods again Conflicts: activesupport/lib/active_support/test_case.rb
* Introduce assert_not to replace 'assert !foo'Jeremy Kemper2012-12-281-0/+16
|
* Make test logs easier to read.Jeremy Kemper2012-12-261-11/+10
| | | | | | Tagging every message in tests makes the logs really wide. It's great for grepping, but annoying to open in an editor or a narrow terminal. Try out a different approach: spit out a heading before each test.
* nodoc AS::Testing::ConstantLookup::ClassMethods [ci skip]Carlos Duclos2012-12-011-1/+1
|
* nodoc AS::Testing::Pending because is deprecated [ci skip]Carlos Duclos2012-12-011-2/+2
|
* Properly deprecate #pending from AS::TestCaseCarlos Antonio da Silva2012-11-181-8/+2
| | | | Check https://github.com/rails/rails/pull/4575#issuecomment-5765575.
* Revert "Merge pull request #4575 from carlosantoniodasilva/remove-test-pending"Carlos Antonio da Silva2012-11-181-0/+20
| | | | | | | | | This reverts commit 1620df78dff527b4fa3f7b204fa05d1b630aae17, reversing changes made to 2d000328dfc0d4b297fb4bdcebc9af6c2fb559dc. Conflicts: activesupport/CHANGELOG.md activesupport/lib/active_support/test_case.rb