| Commit message (Collapse) | Author | Age | Files | Lines |
| |
|
|
|
|
|
|
| |
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
|
| |
|
|
|
|
|
|
| |
renamed to `Minitest`
Ref: https://github.com/seattlerb/minitest/blob/master/History.txt
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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.
|
| |
|
|
|
|
|
|
|
|
|
|
| |
+ 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.
|
|
|
|
|
| |
They don't add any benefits over `assert object.blank?`
and `assert object.present?`
|
|
|
|
| |
begin/rescue/else.
|
| |
|
|
|
|
|
|
| |
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.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
When you add one callack in two separate `set_callback` calls - it is
only called once.
When you do it in one `set_callback` call - it is called twice.
This violates the principle of least astonishment for me. Duplicating
callback is usually an error. There is a correct and obvious way to do
anything without this "feature".
If you want to do
before_save :clear_balance, :calculate_tax, :clear_balance
or whatever, you should better do
before_save :carefully_calculate_tax
def carefully_calculate_tax
clear_balance
calculate_tax
clear_balance
end
And this even opens gates for some advanced refactorings, unlike the
first approach.
My assumptions are:
- Principle of least astonishment is violated, when callbacks are either
prevented from duplication, or not.
- Duplicating callbacks is usually an error. When it is intentional -
it's a smell of a bad design and can be approached without abusing
this "feature".
My suggestion is: do not allow duplicating callbacks in one callback
call, like it is not allowed in separate callbacks call.
|
| |
|
| |
|
| |
|
| |
|
| |
|
| |
|
| |
|
|
|
|
| |
's/[ \t]*$//' -i {} \;)
|
|
|
|
| |
Signed-off-by: José Valim <jose.valim@gmail.com>
|
|
|
|
| |
Signed-off-by: Jeremy Kemper <jeremy@bitsweat.net>
|
|
|
|
| |
Signed-off-by: Xavier Noria <fxn@hashref.com>
|
|
|
|
| |
Signed-off-by: Xavier Noria <fxn@hashref.com>
|
| |
|
|
|
|
| |
This reverts commit 29b280666b6a8216a46b8349fa76c85f5b5dcc55.
|
| |
|
| |
|
| |
|
| |
|
| |
|
| |
|
| |
|
| |
|
|
|
|
|
|
|
| |
expression that failed rather than just the expected and actual values
Signed-off-by: Michael Koziarski <michael@koziarski.com>
[#1161 state:committed]
|
|
|
|
| |
base class
|
|
|
|
|
|
| |
teardown, and ActionController::Dispatcher. Closes #10727.
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@8664 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
|
|
|
|
|
|
|
|
|
| |
[Josh Peek]
* TestCase: introduce declared setup and teardown callbacks. Pass a list of methods and an optional block to call before setup or after teardown. Setup callbacks are run in the order declared; teardown callbacks are run in reverse. [Jeremy Kemper]
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@8570 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
|
|
|
|
| |
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@8563 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
|
|
|
|
| |
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@8041 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
|
|
|
|
| |
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@8040 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
|
|
|
|
|
|
| |
Proc#binding usage
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@7682 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
|
|
|
|
| |
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@6926 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
|
|
|
|
| |
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@6772 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
|
|
|
|
| |
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@6701 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
|
|
|
|
|
|
| |
evaluated before and after the passed in block. See documenation for examples of new API. [Marcel Molina Jr.]
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@6693 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
|
|
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@6647 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
|