Sha256: dcff39fb44a704a58944c3a88fdcd1d676e12bc4c51fefa70b452b3df9e30fd8

Contents?: true

Size: 1006 Bytes

Versions: 1

Compression:

Stored size: 1006 Bytes

Contents

require 'spec_helper'

describe 'Veritas::Attribute#==' do
  subject { object == other }

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

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

    it { should be(true) }

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

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

    it { should be(true) }

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

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

    it { should be(true) }

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

  context 'with an object having a different name' do
    let(:other_name) { :other_id             }
    let(:other)      { klass.new(other_name) }

    it { should be(false) }

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

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
veritas-0.0.2 spec/unit/veritas/attribute/equal_value_spec.rb