Sha256: 0e560a6c1d787fc6910b39f3da9dc27244c4304ab1f1231915cc9d9fec217e50

Contents?: true

Size: 950 Bytes

Versions: 52

Compression:

Stored size: 950 Bytes

Contents

require File.expand_path('../../../spec_helper', __FILE__)

describe "Bignum#==" do
  before(:each) do
    @bignum = bignum_value
  end

  it "returns true if self has the same value as the given argument" do
    (@bignum == @bignum).should == true
    (@bignum == @bignum.to_f).should == true

    (@bignum == @bignum + 1).should == false
    (@bignum + 1 == @bignum).should == false

    (@bignum == 9).should == false
    (@bignum == 9.01).should == false

    (@bignum == bignum_value(10)).should == false
  end

  it "calls 'other == self' if the given argument is not an Integer" do
    obj = mock('not integer')
    obj.should_receive(:==).and_return(true)
    (@bignum == obj).should == true
  end

  it "returns the result of 'other == self' as a boolean" do
    obj = mock('not integer')
    obj.should_receive(:==).exactly(2).times.and_return("woot", nil)
    (@bignum == obj).should == true
    (@bignum == obj).should == false
  end
end

Version data entries

52 entries across 52 versions & 2 rubygems

Version Path
rhodes-7.6.0 spec/framework_spec/app/spec/core/bignum/equal_value_spec.rb
rhodes-7.5.1 spec/framework_spec/app/spec/core/bignum/equal_value_spec.rb
rhodes-7.4.1 spec/framework_spec/app/spec/core/bignum/equal_value_spec.rb
rhodes-7.1.17 spec/framework_spec/app/spec/core/bignum/equal_value_spec.rb
rhodes-6.2.0 spec/framework_spec/app/spec/core/bignum/equal_value_spec.rb
rhodes-6.0.11 spec/framework_spec/app/spec/core/bignum/equal_value_spec.rb
rhodes-5.5.18 spec/framework_spec/app/spec/core/bignum/equal_value_spec.rb
rhodes-5.5.17 spec/framework_spec/app/spec/core/bignum/equal_value_spec.rb
rhodes-5.5.15 spec/framework_spec/app/spec/core/bignum/equal_value_spec.rb
rhodes-5.5.0.22 spec/framework_spec/app/spec/core/bignum/equal_value_spec.rb
rhodes-5.5.2 spec/framework_spec/app/spec/core/bignum/equal_value_spec.rb
rhodes-5.5.0.7 spec/framework_spec/app/spec/core/bignum/equal_value_spec.rb
rhodes-5.5.0.3 spec/framework_spec/app/spec/core/bignum/equal_value_spec.rb
rhodes-5.5.0 spec/framework_spec/app/spec/core/bignum/equal_value_spec.rb
tauplatform-1.0.3 spec/framework_spec/app/spec/core/bignum/equal_value_spec.rb
tauplatform-1.0.2 spec/framework_spec/app/spec/core/bignum/equal_value_spec.rb
tauplatform-1.0.1 spec/framework_spec/app/spec/core/bignum/equal_value_spec.rb
rhodes-3.5.1.12 spec/framework_spec/app/spec/core/bignum/equal_value_spec.rb
rhodes-3.3.5 spec/framework_spec/app/spec/core/bignum/equal_value_spec.rb
rhodes-3.4.2 spec/framework_spec/app/spec/core/bignum/equal_value_spec.rb