Sha256: 6820b5142a2355a76991c9409774b20eccf130b954b57a751db691c3e0490c01
Contents?: true
Size: 939 Bytes
Versions: 8
Compression:
Stored size: 939 Bytes
Contents
require 'spec_helper' describe Virtus::AttributeSet, '#merge' do subject { object.merge(other) } let(:parent) { described_class.new } let(:object) { described_class.new(parent, attributes) } let(:name) { :name } let(:other) { [attribute] } context 'with a new attribute' do let(:attributes) { [] } let(:attribute) { Virtus::Attribute.build(String, :name => name) } it { is_expected.to 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) { [Virtus::Attribute.build(String, :name => name)] } let(:attribute) { Virtus::Attribute.build(String, :name => name) } it { is_expected.to 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
8 entries across 6 versions & 3 rubygems