Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 6 additions & 9 deletions core/time/at_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -83,15 +83,15 @@
describe "with an argument that responds to #to_r" do
ruby_version_is ""..."1.9" do
it "raises a TypeError" do
o = mock('rational')
o = mock_numeric('rational')
o.should_not_receive(:to_r)
lambda { Time.at(o) }.should raise_error(TypeError)
end
end

ruby_version_is "1.9" do
it "coerces using #to_r" do
o = mock('rational')
o = mock_numeric('rational')
o.should_receive(:to_r).and_return(Rational(5, 2))
Time.at(o).should == Time.at(Rational(5, 2))
end
Expand Down Expand Up @@ -134,7 +134,7 @@

ruby_version_is "1.9" do
it "coerces using #to_r" do
o = mock('rational')
o = mock_numeric('rational')
o.should_receive(:to_r).and_return(Rational(5, 2))
Time.at(0, o).should == Time.at(0, Rational(5, 2))
end
Expand All @@ -160,12 +160,9 @@
end
end

ruby_version_is "1.9" do
it "returns a Time object equal to the specified time plus the number of microseconds" do
t1 = Time.at(10)
t2 = Time.at(t1, 500000)
t2.tv_sec.should == 10
t2.tv_usec.should == 500000
ruby_bug "#8173", "2.0" do
it "raises a TypeError" do
lambda { Time.at(Time.now, 500000) }.should raise_error(TypeError)
end
end
end
Expand Down
2 changes: 1 addition & 1 deletion core/time/getlocal_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@

describe "with an argument that responds to #to_r" do
it "coerces using #to_r" do
o = mock('rational')
o = mock_numeric('rational')
o.should_receive(:to_r).and_return(Rational(7201, 2))
t = Time.gm(2007, 1, 9, 12, 0, 0).getlocal(o)
t.should == Time.new(2007, 1, 9, 13, 0, Rational(1, 2), Rational(7201, 2))
Expand Down
2 changes: 1 addition & 1 deletion core/time/localtime_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@

describe "with an argument that responds to #to_r" do
it "coerces using #to_r" do
o = mock('rational')
o = mock_numeric('rational')
o.should_receive(:to_r).and_return(Rational(7201, 2))
t = Time.gm(2007, 1, 9, 12, 0, 0)
t.localtime(o)
Expand Down
2 changes: 1 addition & 1 deletion core/time/minus_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
ruby_version_is "1.9" do
#see [ruby-dev:38446]
it "accepts arguments that can be coerced into Rational" do
(obj = mock('10')).should_receive(:to_r).and_return(Rational(10))
(obj = mock_numeric('10')).should_receive(:to_r).and_return(Rational(10))
(Time.at(100) - obj).should == Time.at(90)
end
end
Expand Down
2 changes: 1 addition & 1 deletion core/time/new_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@

describe "with an argument that responds to #to_r" do
it "coerces using #to_r" do
o = mock('rational')
o = mock_numeric('rational')
o.should_receive(:to_r).and_return(Rational(5, 2))
Time.new(2000, 1, 1, 0, 0, 0, o).utc_offset.should eql(Rational(5, 2))
end
Expand Down
2 changes: 1 addition & 1 deletion core/time/plus_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@
end

it "accepts arguments that can be coerced into Rational" do
(obj = mock('10')).should_receive(:to_r).and_return(Rational(10))
(obj = mock_numeric('10')).should_receive(:to_r).and_return(Rational(10))
(Time.at(100) + obj).should == Time.at(110)
end

Expand Down