Sha256: e3940940957642dc0c9f1f514bf65c05c58c1eab747480f3baa45be10d97160b

Contents?: true

Size: 1.44 KB

Versions: 30

Compression:

Stored size: 1.44 KB

Contents

require 'spec_helper'

require 'person'

describe Gummi::EntityLayer::Entity do

  context 'comparison' do
    let(:car)    { Person::Car.new model: 'Blues Mobile' }
    let (:jake1) { Person.new id: 'abcdef', version: 1, name: 'Jake', born_at: 100.years.ago, car: car }
    let (:jake2) { Person.new id: 'abcdef', version: 1, name: 'Jake', born_at: 100.years.ago, car: car }
    let (:jake3) { Person.new id: 'ghijgk', version: 1, name: 'Jake', born_at: 100.years.ago, car: car }
    let (:jake4) { Person.new id: 'abcdef', version: 1, name: 'John', born_at: 100.years.ago, car: car }
    let (:jake5) { Person.new id: 'abcdef', version: 2, name: 'Jake', born_at: 100.years.ago, car: car }
    let (:jake6) { Person.new id: 'abcdef', version: 1, name: 'Jake', born_at: 100.years.ago, car: Person::Car.new(model: 'Blues Mobile') }
    let (:jake7) { Person.new id: 'abcdef', version: 2, name: 'Jake', born_at: 100.years.ago, car: Person::Car.new(model: 'Police Car') }

    it 'recognizes equal objects' do
      jake1.should == jake2
    end

    it 'recognizes different ids' do
      jake1.should_not == jake3
    end

    it 'recognizes different attributes' do
      jake1.should_not == jake4
    end

    it 'recognizes different versions' do
      jake1.should_not == jake5
    end

    it 'recognizes equal submodel instances' do
      jake1.should == jake6
    end

    it 'recognizes different submodel attributes' do
      jake1.should_not == jake7
    end
  end

end

Version data entries

30 entries across 30 versions & 1 rubygems

Version Path
gummi-0.3.5 spec/lib/gummi/entity_layer/entity_spec.rb
gummi-0.3.4 spec/lib/gummi/entity_layer/entity_spec.rb
gummi-0.3.3 spec/lib/gummi/entity_layer/entity_spec.rb
gummi-0.3.2 spec/lib/gummi/entity_layer/entity_spec.rb
gummi-0.3.1 spec/lib/gummi/entity_layer/entity_spec.rb
gummi-0.3.0 spec/lib/gummi/entity_layer/entity_spec.rb
gummi-0.2.3 spec/lib/gummi/entity_layer/entity_spec.rb
gummi-0.2.2 spec/lib/gummi/entity_layer/entity_spec.rb
gummi-0.2.1 spec/lib/gummi/entity_layer/entity_spec.rb
gummi-0.2.0 spec/lib/gummi/entity_layer/entity_spec.rb