Ian Fleeton
684ae07e2f
Don't encourage using octals for dates and times
...
This could result in confusing errors or inconsistency for 08 and 09
2020-01-15 10:57:38 +00:00
Michael Grosser
203998c916
allow running each test with pure ruby path/to/test.rb
...
also:
- makes test dependencies obvious
- makes tests runnable from within subfolders
2019-12-18 08:49:19 -06:00
Tim Masliuchenko
21f907bb51
Accept block in travel_back time helper
2019-11-10 20:02:09 +01:00
alkesh26
38472af70e
ActiveSupport typo fixes.
2019-02-01 22:17:10 +05:30
Ryuta Kamizono
b75192845a
Merge pull request #34764 from kamipo/avoid_redundant_begin
...
Enable `Style/RedundantBegin` cop to avoid newly adding redundant begin block
2018-12-21 17:36:30 +09:00
yuuji.yaginuma
5d905abbe7
Add test for travel_to
with time zone
...
This is a regression test for #34751 .
2018-12-21 10:08:33 +09:00
Ryuta Kamizono
892e38c78e
Enable Style/RedundantBegin
cop to avoid newly adding redundant begin block
...
Currently we sometimes find a redundant begin block in code review
(e.g. https://github.com/rails/rails/pull/33604#discussion_r209784205 ).
I'd like to enable `Style/RedundantBegin` cop to avoid that, since
rescue/else/ensure are allowed inside do/end blocks in Ruby 2.5
(https://bugs.ruby-lang.org/issues/12906 ), so we'd probably meets with
that situation than before.
2018-12-21 06:12:42 +09:00
ryanwhocodes
36e6571a40
Add #unfreeze_time to ActiveSupport::Testing::TimeHelpers
2018-09-10 22:32:41 +01:00
Ryuta Kamizono
245c1dafa8
Enable Layout/LeadingCommentSpace
to not allow cosmetic changes in the future
...
Follow up of #31432 .
2017-12-14 17:30:54 +09:00
Koichi ITO
ac717d65a3
[Active Support] rubocop -a --only Layout/EmptyLineAfterMagicComment
2017-07-11 13:12:32 +09:00
प्रथमेश Sonpatki
b6300f3ecc
Added time helper method freeze_time
which is an alias for travel_to Time.now
( #29681 )
2017-07-10 12:13:37 +02:00
Kir Shatrov
72950568dd
Use frozen-string-literal in ActiveSupport
2017-07-09 15:08:29 +03:00
Matthew Draper
87b3e226d6
Revert "Merge pull request #29540 from kirs/rubocop-frozen-string"
...
This reverts commit 3420a14590c0e6915d8b6c242887f74adb4120f9, reversing
changes made to afb66a5a598ce4ac74ad84b125a5abf046dcf5aa.
2017-07-02 02:15:17 +09:30
Kir Shatrov
cfade1ec7e
Enforce frozen string in Rubocop
2017-07-01 02:11:03 +03:00
Ryuta Kamizono
b201474756
Should escape meta characters in regexp
2017-05-07 04:10:00 +09:00
yuuji.yaginuma
c42bd31977
correctly check error message
...
`assert_raise` does not check error message. However, in some tests,
it seems like expecting error message checking with `assert_raise`.
Instead of specifying an error message in `assert_raise`, modify to use
another assert to check the error message.
2017-01-25 09:58:15 +09:00
Jonas Nicklas
3d78949c74
Make time travel work with subclasses of Time/Date/Datetime
...
Closes #27614
Previously when calling `now` on a subclass of e.g. `Time` it would return an instance of `Time` instead of returning an instance of the subclass. This way, we always return the correct class.
2017-01-10 11:43:26 +01:00
Xavier Noria
a731125f12
applies new string literal convention in activesupport/test
...
The current code base is not uniform. After some discussion,
we have chosen to go with double quotes by default.
2016-08-06 18:10:53 +02:00
Rafael Mendonça França
bbbabc22c1
Make sure the time method is unstubed
...
The minitest stubs were conflicting with the time travel stubs so the
travel_back method call in the teardown block was actually keeping the
time stubbed.
2016-07-17 05:13:20 -03:00
Vipul A M
919e705362
travel/travel_to
travel time helpers, now raise on nested calls,
...
as this can lead to confusing time stubbing.
Instead of:
travel_to 2.days.from_now do
# 2 days from today
travel_to 3.days.from_now do
# 5 days from today
end
end
preferred way to achieve above is:
travel_to 2.days.from_now
# 2 days from today
travel_back
travel_to 5.days.from_now
# 5 days from today
Closes #24690
Fixes #24689
2016-07-02 15:09:34 -07:00
Ronak Jangir
81d2ce96d0
Removed mocha stubbing in active_support
2015-06-07 19:18:58 +05:30
Ankit Gupta
40fe833493
as/core_ext require's not used
2015-05-08 10:39:30 -04:00
Yuki Nishijima
a57ddc58ac
Change AS::Testing::TimeHelpers#travel_to to also stub DateTime.now
2015-02-03 05:23:23 -08:00
Zachary Scott
a5d50ac147
Move date and time requires to time_travel_test, also include
...
'abstract_unit'.
cc #16564
2014-08-19 13:17:23 -07:00
Zachary Scott
ab291e8718
Move TimeHelperTest to TimeTravelTest from as/test_test.rb
2014-08-19 11:29:26 -07:00