Sha256: ad08363f78aa0781588cd809b7b6b09bbb05642c2c2f48903f7161821aa57992

Contents?: true

Size: 892 Bytes

Versions: 1

Compression:

Stored size: 892 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')

      expect(a).to_not be_same_as(b)
      expect(a.attributes).to_not eq(b.attributes)
      expect(a.attributes_without_ignored_attributes).to_not eq(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')

      expect(a).to be_same_as(b)
      expect(a.attributes).to_not eq(b.attributes)
      expect(a.attributes_without_ignored_attributes).to eq(b.attributes_without_ignored_attributes)
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
active_record_ignored_attributes-0.0.5 spec/same_as_spec.rb