Sha256: 85395cdfb6f4cbda09bbd19a2fad79f5385e1d387cebb0bf038cc1297a34f4ac
Contents?: true
Size: 1.09 KB
Versions: 5
Compression:
Stored size: 1.09 KB
Contents
require 'spec_helper' describe Virtus::AttributeSet, '#merge' do subject { object.merge(other) } let(:attributes) { [] } let(:parent) { described_class.new } let(:object) { described_class.new(parent, attributes) } let(:name) { :name } let(:other) { [ attribute ] } before { attribute.stub(:define_accessor_methods) } context 'with a new attribute' do let(:attribute) { mock('Attribute', :name => name) } it { should equal(object) } it 'adds an attribute' do expect { subject }.to change { object.to_a }. from(attributes). to([ attribute ]) end end context 'with a duplicate attribute' do let(:attributes) { [ mock('Attribute', :name => name) ] } let(:attribute) { mock('Duplicate', :name => name) } it { should equal(object) } it 'replaces the original attribute' do expect { subject }.to change { object.to_a }. from(attributes). to([ attribute ]) end end end
Version data entries
5 entries across 5 versions & 2 rubygems