Sha256: 369eb0698a4bfa8552215cde44425f0b96c806177e1b68d45d529ab2f1039d18
Contents?: true
Size: 748 Bytes
Versions: 2
Compression:
Stored size: 748 Bytes
Contents
require 'spec_helper' describe Virtus::Attribute::Collection, '#coerce' do subject { attribute.coerce(value) } let(:attribute) { Class.new(described_class).new(:things, :member_type => member_type) } let(:value) { [ entry ] } let(:entry) { mock('entry') } let(:member_type) { Virtus::Attribute::Object } before do value.should_receive(:respond_to?).with(:inject).and_return(respond_to_inject) end context 'when coerced value responds to #inject' do let(:respond_to_inject) { true } specify { expect { subject }.to raise_error(NotImplementedError) } end context 'when coerced value does not respond to #inject' do let(:respond_to_inject) { false } specify { should eql(value) } end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
virtus-0.3.0 | spec/unit/virtus/attribute/collection/coerce_spec.rb |
virtus-0.2.0 | spec/unit/virtus/attribute/collection/coerce_spec.rb |