diff --git a/core/time/at_spec.rb b/core/time/at_spec.rb index c7b8755495..1a2cfa5b28 100644 --- a/core/time/at_spec.rb +++ b/core/time/at_spec.rb @@ -83,7 +83,7 @@ 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 @@ -91,7 +91,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(o).should == Time.at(Rational(5, 2)) end @@ -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 @@ -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 diff --git a/core/time/getlocal_spec.rb b/core/time/getlocal_spec.rb index f7beae2bec..4883b17a00 100644 --- a/core/time/getlocal_spec.rb +++ b/core/time/getlocal_spec.rb @@ -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)) diff --git a/core/time/localtime_spec.rb b/core/time/localtime_spec.rb index 1d8f6162b8..b9273cd5fa 100644 --- a/core/time/localtime_spec.rb +++ b/core/time/localtime_spec.rb @@ -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) diff --git a/core/time/minus_spec.rb b/core/time/minus_spec.rb index 2920733bfc..90894fc6d3 100644 --- a/core/time/minus_spec.rb +++ b/core/time/minus_spec.rb @@ -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 diff --git a/core/time/new_spec.rb b/core/time/new_spec.rb index 297dca6a52..cea1452801 100644 --- a/core/time/new_spec.rb +++ b/core/time/new_spec.rb @@ -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 diff --git a/core/time/plus_spec.rb b/core/time/plus_spec.rb index 7442c07691..d835eabcde 100644 --- a/core/time/plus_spec.rb +++ b/core/time/plus_spec.rb @@ -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