Sha256: c18a2b9dd95d47d666f93617a319a414ee6e3d24349fbbe79665b7a825524875

Contents?: true

Size: 1.15 KB

Versions: 1

Compression:

Stored size: 1.15 KB

Contents

require 'spec_helper'

describe 'Veritas::Relation::Operation::Order::DirectionSet#eql?' do
  subject { object.eql?(other) }

  let(:klass)      { Relation::Operation::Order::DirectionSet }
  let(:attributes) { [ Attribute::Integer.new(:id) ]          }
  let(:object)     { klass.new(attributes)                    }

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

    it { should be(true) }

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

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

    it { should be(true) }

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

  context 'with equivalent object of a subclass' do
    let(:other) { Class.new(klass).new(attributes) }

    it { should be(false) }

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

  context 'with an object having different attributes' do
    let(:other_attributes) { [ Attribute::Integer.new(:other_id) ] }
    let(:other)            { klass.new(other_attributes)           }

    it { should be(false) }

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

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
veritas-0.0.2 spec/unit/veritas/relation/operation/order/direction_set/eql_spec.rb