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-1.0.10 spec/lib/gummi/entity_layer/entity_spec.rb
gummi-1.0.9 spec/lib/gummi/entity_layer/entity_spec.rb
gummi-1.0.8 spec/lib/gummi/entity_layer/entity_spec.rb
gummi-1.0.7 spec/lib/gummi/entity_layer/entity_spec.rb
gummi-1.0.6 spec/lib/gummi/entity_layer/entity_spec.rb
gummi-1.0.5 spec/lib/gummi/entity_layer/entity_spec.rb
gummi-1.0.4 spec/lib/gummi/entity_layer/entity_spec.rb
gummi-0.3.16 spec/lib/gummi/entity_layer/entity_spec.rb
gummi-1.0.3 spec/lib/gummi/entity_layer/entity_spec.rb
gummi-1.0.2 spec/lib/gummi/entity_layer/entity_spec.rb
gummi-1.0.0 spec/lib/gummi/entity_layer/entity_spec.rb
gummi-0.3.14 spec/lib/gummi/entity_layer/entity_spec.rb
gummi-0.3.13 spec/lib/gummi/entity_layer/entity_spec.rb
gummi-0.3.12 spec/lib/gummi/entity_layer/entity_spec.rb
gummi-0.3.11 spec/lib/gummi/entity_layer/entity_spec.rb
gummi-0.3.10 spec/lib/gummi/entity_layer/entity_spec.rb
gummi-0.3.9 spec/lib/gummi/entity_layer/entity_spec.rb
gummi-0.3.8 spec/lib/gummi/entity_layer/entity_spec.rb
gummi-0.3.7 spec/lib/gummi/entity_layer/entity_spec.rb
gummi-0.3.6 spec/lib/gummi/entity_layer/entity_spec.rb