Sha256: 73da6d44db97c4a421e45579fd5236fabe84e1f3f492f1cdbde9d7dd90bcd945

Contents?: true

Size: 602 Bytes

Versions: 2

Compression:

Stored size: 602 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) }

    it 'should apply structural equality' do
      (attr1 == attr2).should be_true
    end

    it 'should distinguish different attributes' do
      (attr1 == attr3).should be_false
    end

    it 'should return nil if not equal' do
      (attr1 == 12).should be_nil
    end

    it 'should implement hash accordingly' do
      attr1.hash.should eq(attr2.hash)
    end

  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
finitio-0.4.1 spec/unit/attribute/test_equality.rb
finitio-0.4.0 spec/unit/attribute/test_equality.rb