Sha256: eb9fb60de4411ecfd0598e6f51e72942062698edac6059c0da30daaae12b9c38

Contents?: true

Size: 1.12 KB

Versions: 80

Compression:

Stored size: 1.12 KB

Contents

require File.dirname(File.join(__rhoGetCurrentDir(), __FILE__)) + '/../../../spec_helper'
require File.dirname(File.join(__rhoGetCurrentDir(), __FILE__)) + '/shared/constants'

describe "Digest::MD5#==" do

  it 'should be equal to itself' do
    cur_digest = Digest::MD5.new
    cur_digest.should == cur_digest
  end

  it 'should be equal to string representing its hexdigest' do
    cur_digest = Digest::MD5.new
    cur_digest.should == MD5Constants::BlankHexdigest
  end

  it 'should be equal to appropriate object that responds to to_str' do
    # blank digest
    cur_digest = Digest::MD5.new
    obj = mock(MD5Constants::BlankHexdigest)
    obj.should_receive(:to_str).and_return(MD5Constants::BlankHexdigest)
    cur_digest.should == obj

    # non-blank digest
    cur_digest = Digest::MD5.new
    cur_digest << "test"
    d_value = cur_digest.hexdigest
    (obj = mock(d_value)).should_receive(:to_str).and_return(d_value)
    cur_digest.should == obj
  end

  it 'should be equal for same digest different object' do
    cur_digest = Digest::MD5.new
    cur_digest2 = Digest::MD5.new
    cur_digest.should == cur_digest2
  end

end

Version data entries

80 entries across 80 versions & 1 rubygems

Version Path
rhodes-3.1.1 spec/framework_spec/app/spec/library/digest/md5/equal_spec.rb
rhodes-3.1.1.beta spec/framework_spec/app/spec/library/digest/md5/equal_spec.rb
rhodes-3.1.0 spec/framework_spec/app/spec/library/digest/md5/equal_spec.rb
rhodes-3.1.0.beta.5 spec/framework_spec/app/spec/library/digest/md5/equal_spec.rb
rhodes-3.1.0.beta.4 spec/framework_spec/app/spec/library/digest/md5/equal_spec.rb
rhodes-3.1.0.beta.3 spec/framework_spec/app/spec/library/digest/md5/equal_spec.rb
rhodes-3.1.0.beta.2 spec/framework_spec/app/spec/library/digest/md5/equal_spec.rb
rhodes-3.1.0.beta.1 spec/framework_spec/app/spec/library/digest/md5/equal_spec.rb
rhodes-3.0.2 spec/framework_spec/app/spec/library/digest/md5/equal_spec.rb
rhodes-3.0.2.beta.1 spec/framework_spec/app/spec/library/digest/md5/equal_spec.rb
rhodes-3.0.1 spec/framework_spec/app/spec/library/digest/md5/equal_spec.rb
rhodes-3.0.1.beta.8 spec/framework_spec/app/spec/library/digest/md5/equal_spec.rb
rhodes-3.0.1.beta.7 spec/framework_spec/app/spec/library/digest/md5/equal_spec.rb
rhodes-3.0.1.beta.6 spec/framework_spec/app/spec/library/digest/md5/equal_spec.rb
rhodes-3.0.1.beta.5 spec/framework_spec/app/spec/library/digest/md5/equal_spec.rb
rhodes-3.0.1.beta.4 spec/framework_spec/app/spec/library/digest/md5/equal_spec.rb
rhodes-3.0.1.beta.3 spec/framework_spec/app/spec/library/digest/md5/equal_spec.rb
rhodes-3.0.1.beta.2 spec/framework_spec/app/spec/library/digest/md5/equal_spec.rb
rhodes-3.0.0 spec/framework_spec/app/spec/library/digest/md5/equal_spec.rb
rhodes-3.0.0.beta.7 spec/framework_spec/app/spec/library/digest/md5/equal_spec.rb