Sha256: 5a366e01612ea84b1d7b4494e8a3acdf8d04ab5f5a730e033c745be559c2a143

Contents?: true

Size: 864 Bytes

Versions: 4

Compression:

Stored size: 864 Bytes

Contents

require 'spec_helper'

describe Address do
  describe 'same_as?' do
    let(:address) { Address.new }

    it 'should return false even if any of the non-ignored attributes differ' do
      a = Address.new(address: '123 A Street')
      b = Address.new(address: '345 K Street')

      a.should_not be_same_as(b)
      a.attributes.should_not == b.attributes
      a.attributes_without_ignored_attributes.should_not == b.attributes_without_ignored_attributes
    end

    it 'should still return true even if some of the ignored attributes differ' do
      a = Address.new(name: 'A', address: 'The Same Address')
      b = Address.new(name: 'B', address: 'The Same Address')

      a.should be_same_as(b)
      a.attributes.should_not == b.attributes
      a.attributes_without_ignored_attributes.should == b.attributes_without_ignored_attributes
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
active_record_ignored_attributes-0.0.4 spec/same_as_spec.rb
active_record_ignored_attributes-0.0.3 spec/same_as_spec.rb
active_record_ignored_attributes-0.0.2 spec/same_as_spec.rb
active_record_ignored_attributes-0.0.1 spec/same_as_spec.rb