diff options
Diffstat (limited to 'spec/rubyspec/core/float/shared/modulo.rb')
-rw-r--r-- | spec/rubyspec/core/float/shared/modulo.rb | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/spec/rubyspec/core/float/shared/modulo.rb b/spec/rubyspec/core/float/shared/modulo.rb index 9ac967389c..6c423a3a28 100644 --- a/spec/rubyspec/core/float/shared/modulo.rb +++ b/spec/rubyspec/core/float/shared/modulo.rb @@ -35,6 +35,12 @@ describe :float_modulo, shared: true do (1/r).should < 0 end + it "tries to coerce the modulus" do + obj = mock("modulus") + obj.should_receive(:coerce).with(1.25).and_return([1.25, 0.5]) + (1.25 % obj).should == 0.25 + end + it "raises a ZeroDivisionError if other is zero" do lambda { 1.0.send(@method, 0) }.should raise_error(ZeroDivisionError) lambda { 1.0.send(@method, 0.0) }.should raise_error(ZeroDivisionError) |