提交 684ae07e 编写于 作者: I Ian Fleeton

Don't encourage using octals for dates and times

This could result in confusing errors or inconsistency for 08 and 09
上级 bdc7ebc6
......@@ -76,7 +76,7 @@ def test_should_enqueue_and_run_correctly_in_activejob
end
test "should enqueue a delivery with a delay" do
travel_to Time.new(2004, 11, 24, 01, 04, 44) do
travel_to Time.new(2004, 11, 24, 1, 4, 44) do
assert_performed_with(job: ActionMailer::MailDeliveryJob, at: Time.current + 10.minutes, args: ["DelayedMailer", "test_message", "deliver_now", args: [1, 2, 3]]) do
@mail.deliver_later wait: 10.minutes
end
......
......@@ -86,7 +86,7 @@ def travel(duration, &block)
# The stubs are automatically removed at the end of the test.
#
# Time.current # => Sat, 09 Nov 2013 15:34:49 EST -05:00
# travel_to Time.zone.local(2004, 11, 24, 01, 04, 44)
# travel_to Time.zone.local(2004, 11, 24, 1, 4, 44)
# Time.current # => Wed, 24 Nov 2004 01:04:44 EST -05:00
# Date.current # => Wed, 24 Nov 2004
# DateTime.current # => Wed, 24 Nov 2004 01:04:44 -0500
......@@ -108,7 +108,7 @@ def travel(duration, &block)
# state at the end of the block:
#
# Time.current # => Sat, 09 Nov 2013 15:34:49 EST -05:00
# travel_to Time.zone.local(2004, 11, 24, 01, 04, 44) do
# travel_to Time.zone.local(2004, 11, 24, 1, 4, 44) do
# Time.current # => Wed, 24 Nov 2004 01:04:44 EST -05:00
# end
# Time.current # => Sat, 09 Nov 2013 15:34:49 EST -05:00
......@@ -165,7 +165,7 @@ def travel_to(date_or_time)
#
# Time.current # => Sat, 09 Nov 2013 15:34:49 EST -05:00
#
# travel_to Time.zone.local(2004, 11, 24, 01, 04, 44)
# travel_to Time.zone.local(2004, 11, 24, 1, 4, 44)
# Time.current # => Wed, 24 Nov 2004 01:04:44 EST -05:00
#
# travel_back
......@@ -175,7 +175,7 @@ def travel_to(date_or_time)
#
# Time.current # => Sat, 09 Nov 2013 15:34:49 EST -05:00
#
# travel_to Time.zone.local(2004, 11, 24, 01, 04, 44)
# travel_to Time.zone.local(2004, 11, 24, 1, 4, 44)
# Time.current # => Wed, 24 Nov 2004 01:04:44 EST -05:00
#
# travel_back do
......
......@@ -43,7 +43,7 @@ def test_time_helper_travel_with_block
def test_time_helper_travel_to
Time.stub(:now, Time.now) do
expected_time = Time.new(2004, 11, 24, 01, 04, 44)
expected_time = Time.new(2004, 11, 24, 1, 4, 44)
travel_to expected_time
assert_equal expected_time, Time.now
......@@ -56,7 +56,7 @@ def test_time_helper_travel_to
def test_time_helper_travel_to_with_block
Time.stub(:now, Time.now) do
expected_time = Time.new(2004, 11, 24, 01, 04, 44)
expected_time = Time.new(2004, 11, 24, 1, 4, 44)
travel_to expected_time do
assert_equal expected_time, Time.now
......@@ -86,7 +86,7 @@ def test_time_helper_travel_to_with_time_zone
def test_time_helper_travel_back
Time.stub(:now, Time.now) do
expected_time = Time.new(2004, 11, 24, 01, 04, 44)
expected_time = Time.new(2004, 11, 24, 1, 4, 44)
travel_to expected_time
assert_equal expected_time, Time.now
......@@ -104,7 +104,7 @@ def test_time_helper_travel_back
def test_time_helper_travel_back_with_block
Time.stub(:now, Time.now) do
expected_time = Time.new(2004, 11, 24, 01, 04, 44)
expected_time = Time.new(2004, 11, 24, 1, 4, 44)
travel_to expected_time
assert_equal expected_time, Time.now
......@@ -127,8 +127,8 @@ def test_time_helper_travel_back_with_block
def test_time_helper_travel_to_with_nested_calls_with_blocks
Time.stub(:now, Time.now) do
outer_expected_time = Time.new(2004, 11, 24, 01, 04, 44)
inner_expected_time = Time.new(2004, 10, 24, 01, 04, 44)
outer_expected_time = Time.new(2004, 11, 24, 1, 4, 44)
inner_expected_time = Time.new(2004, 10, 24, 1, 4, 44)
travel_to outer_expected_time do
e = assert_raises(RuntimeError) do
travel_to(inner_expected_time) do
......@@ -142,8 +142,8 @@ def test_time_helper_travel_to_with_nested_calls_with_blocks
def test_time_helper_travel_to_with_nested_calls
Time.stub(:now, Time.now) do
outer_expected_time = Time.new(2004, 11, 24, 01, 04, 44)
inner_expected_time = Time.new(2004, 10, 24, 01, 04, 44)
outer_expected_time = Time.new(2004, 11, 24, 1, 4, 44)
inner_expected_time = Time.new(2004, 10, 24, 1, 4, 44)
travel_to outer_expected_time do
assert_nothing_raised do
travel_to(inner_expected_time)
......@@ -156,8 +156,8 @@ def test_time_helper_travel_to_with_nested_calls
def test_time_helper_travel_to_with_subsequent_calls
Time.stub(:now, Time.now) do
initial_expected_time = Time.new(2004, 11, 24, 01, 04, 44)
subsequent_expected_time = Time.new(2004, 10, 24, 01, 04, 44)
initial_expected_time = Time.new(2004, 11, 24, 1, 4, 44)
subsequent_expected_time = Time.new(2004, 10, 24, 1, 4, 44)
assert_nothing_raised do
travel_to initial_expected_time
travel_to subsequent_expected_time
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册