summaryrefslogtreecommitdiff
path: root/spec/ruby/core/integer/shared/equal.rb
diff options
context:
space:
mode:
Diffstat (limited to 'spec/ruby/core/integer/shared/equal.rb')
-rw-r--r--spec/ruby/core/integer/shared/equal.rb9
1 files changed, 7 insertions, 2 deletions
diff --git a/spec/ruby/core/integer/shared/equal.rb b/spec/ruby/core/integer/shared/equal.rb
index 03416b60f5..c621ba3f81 100644
--- a/spec/ruby/core/integer/shared/equal.rb
+++ b/spec/ruby/core/integer/shared/equal.rb
@@ -4,14 +4,14 @@ describe :integer_equal, shared: true do
1.send(@method, 1).should == true
9.send(@method, 5).should == false
- # Actually, these call Float#==, Bignum#== etc.
+ # Actually, these call Float#==, Integer#== etc.
9.send(@method, 9.0).should == true
9.send(@method, 9.01).should == false
10.send(@method, bignum_value).should == false
end
- it "calls 'other == self' if the given argument is not a Integer" do
+ it "calls 'other == self' if the given argument is not an Integer" do
1.send(@method, '*').should == false
obj = mock('one other')
@@ -54,5 +54,10 @@ describe :integer_equal, shared: true do
@bignum.send(@method, obj).should == true
@bignum.send(@method, obj).should == false
end
+
+ it "does not lose precision when comparing with a Float" do
+ (bignum_value(1).send(@method, bignum_value.to_f)).should == false
+ (bignum_value.send(@method, bignum_value.to_f)).should == true
+ end
end
end