Sha256: e2dea263b3ab4b6922cbec045974837a3c20ba0a013c9647a8f56da86f2fcd49

Contents?: true

Size: 578 Bytes

Versions: 4

Compression:

Stored size: 578 Bytes

Contents

require 'spec_helper'

describe ValueStruct::DupWithChanges do
  subject do
    ValueStruct.new_with_mixins(:x, :y, [ValueStruct::DupWithChanges]).new(1,2)
  end

  context 'no arguments' do
    it 'is equal' do
      subject.should == subject.dup
    end

    it 'is another object' do
      subject.object_id.should_not == subject.dup.object_id
    end
  end

  context 'with arguments' do
    let(:modified){ subject.dup(y: 5) }
    it 'is equal, except for the changed field' do
      subject.x.should == modified.x
      subject.y.should_not == modified.y
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
value_struct-0.8.1 spec/dup_with_changes_spec.rb
value_struct-0.8.0 spec/dup_with_changes_spec.rb
value_struct-0.7.0 spec/dup_with_changes_spec.rb
value_struct-0.6.0 spec/dup_with_changes_spec.rb