Sha256: 42b3262a2eab6b69083fb644fe7189a344eb0609bb90ffaa0fd9933fdadd561c

Contents?: true

Size: 765 Bytes

Versions: 19

Compression:

Stored size: 765 Bytes

Contents

require 'spec_helper'
module Finitio
  describe Attribute, "equality" do

    let(:attr1){ Attribute.new(:red, intType) }
    let(:attr2){ Attribute.new(:red, intType) }
    let(:attr3){ Attribute.new(:blue, intType) }
    let(:attr4){ Attribute.new(:red, intType, false) }

    it 'should apply structural equality' do
      expect(attr1 == attr2).to eq(true)
    end

    it 'should distinguish different attributes' do
      expect(attr1 == attr3).to eq(false)
      expect(attr1 == attr4).to eq(false)
    end

    it 'should false against non Attribute' do
      expect(attr1 == 12).to eq(false)
    end

    it 'should implement hash accordingly' do
      expect(attr1.hash).to eq(attr2.hash)
      expect(attr1.hash).not_to eq(attr4.hash)
    end

  end
end

Version data entries

19 entries across 19 versions & 1 rubygems

Version Path
finitio-0.12.0 spec/attribute/test_equality.rb
finitio-0.11.4 spec/attribute/test_equality.rb
finitio-0.11.3 spec/attribute/test_equality.rb
finitio-0.11.2 spec/attribute/test_equality.rb
finitio-0.11.1 spec/attribute/test_equality.rb
finitio-0.10.0 spec/attribute/test_equality.rb
finitio-0.9.1 spec/attribute/test_equality.rb
finitio-0.9.0 spec/attribute/test_equality.rb
finitio-0.8.0 spec/attribute/test_equality.rb
finitio-0.7.0 spec/attribute/test_equality.rb
finitio-0.7.0.pre.rc4 spec/attribute/test_equality.rb
finitio-0.7.0.pre.rc3 spec/attribute/test_equality.rb
finitio-0.7.0.pre.rc2 spec/attribute/test_equality.rb
finitio-0.7.0.pre.rc1 spec/attribute/test_equality.rb
finitio-0.6.1 spec/attribute/test_equality.rb
finitio-0.6.0 spec/attribute/test_equality.rb
finitio-0.5.2 spec/attribute/test_equality.rb
finitio-0.5.1 spec/attribute/test_equality.rb
finitio-0.5.0 spec/attribute/test_equality.rb