Sha256: 515e6ba17522066e880943c29a00c5c7c75486310017c7a8010c6481f5c61e78
Contents?: true
Size: 993 Bytes
Versions: 7
Compression:
Stored size: 993 Bytes
Contents
require 'spec_helper' describe Virtus::AttributeSet, '#<<' do subject { object << attribute } let(:attributes) { [] } let(:parent) { described_class.new } let(:object) { described_class.new(parent, attributes) } let(:name) { :name } 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
7 entries across 7 versions & 1 rubygems