Sha256: b725069a445ee34ad48ff284ccf0dce35628ed57509ec78eb72e997ed3ddba81

Contents?: true

Size: 919 Bytes

Versions: 3

Compression:

Stored size: 919 Bytes

Contents

require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper')

describe Hamster::Hash do

  [:eql?, :==].each do |method|

    describe "##{method}" do

      [
        [[], [], true],
        [["A" => "aye"], [], false],
        [[], ["A" => "aye"], false],
        [["A" => "aye"], ["A" => "aye"], true],
        [["A" => "aye"], ["B" => "bee"], false],
        [["A" => "aye", "B" => "bee"], ["A" => "aye"], false],
        [["A" => "aye"], ["A" => "aye", "B" => "bee"], false],
        [["A" => "aye", "B" => "bee", "C" => "see"], ["A" => "aye", "B" => "bee", "C" => "see"], true],
        [["C" => "see", "A" => "aye", "B" => "bee"], ["A" => "aye", "B" => "bee", "C" => "see"], true],
      ].each do |a, b, result|

        it "returns #{result} for #{a.inspect} and #{b.inspect}" do
          Hamster.hash(*a).send(method, Hamster.hash(*b)).should == result
        end

      end

    end

  end

end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
hamster-0.1.13 spec/hamster/hash/eql_spec.rb
hamster-0.1.12 spec/hamster/hash/eql_spec.rb
hamster-0.1.11 spec/hamster/hash/eql_spec.rb