Sha256: fb20f411621f3fb988c681940cddcfe5edee948c6355420d94c189d3b3a920e4

Contents?: true

Size: 598 Bytes

Versions: 3

Compression:

Stored size: 598 Bytes

Contents

require 'spec_helper'
module Qrb
  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

3 entries across 3 versions & 1 rubygems

Version Path
qrb-0.3.0 spec/unit/attribute/test_equality.rb
qrb-0.2.0 spec/unit/attribute/test_equality.rb
qrb-0.1.0 spec/unit/attribute/test_equality.rb