Sha256: faaa969e7bbf43faf2875164ecbe4b290a6fb6c971d23abf156b3d045d040fcc

Contents?: true

Size: 997 Bytes

Versions: 1

Compression:

Stored size: 997 Bytes

Contents

require 'spec_helper'

describe 'Veritas::Attribute#eql?' do
  subject { attribute.eql?(other) }

  let(:name)      { :id                          }
  let(:attribute) { Attribute::Integer.new(name) }

  context 'with the same attribute' do
    let(:other) { attribute }

    it { should be(true) }

    it 'is symmetric' do
      should == other.eql?(attribute)
    end
  end

  context 'with an equivalent attribute' do
    let(:other) { attribute.dup }

    it { should be(true) }

    it 'is symmetric' do
      should == other.eql?(attribute)
    end
  end

  context 'with a different attribute' do
    let(:other) { Attribute::String.new(:name) }

    it { should be(false) }

    it 'is symmetric' do
      should == other.eql?(attribute)
    end
  end

  context 'with an equivalent attribute of a different class' do
    let(:other) { Class.new(Attribute::Integer).new(name) }

    it { should be(false) }

    it 'is symmetric' do
      should == other.eql?(attribute)
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
veritas-0.0.1 spec/unit/veritas/attribute/eql_spec.rb