Sha256: 491e4d40c97bf6f8f30464fb7d148edf674920156666b3f8f9b1c8d0b2e90fef
Contents?: true
Size: 904 Bytes
Versions: 9
Compression:
Stored size: 904 Bytes
Contents
require 'spec_helper' describe Virtus::Attribute, '#default' do subject { object.default } let(:object) { described_class.new(:name, options) } let(:options) { { :primitive => primitive, :coercion_method => coercion_method } } let(:primitive) { stub('primitive') } let(:coercion_method) { stub('coercion_method') } context 'when the default is not specified' do it { should be_instance_of(Virtus::Attribute::DefaultValue) } its(:value) { should be_nil } end context 'when the default is specified' do let(:default) { stub('default') } before do options.update(:default => default) end it { should be_instance_of(Virtus::Attribute::DefaultValue::FromClonable) } its(:value) { should be(default) } end end
Version data entries
9 entries across 9 versions & 2 rubygems