Sha256: 0473f7fe5a4621cef6ffe95fdac1d3e9fada44c42fadf7e6a5cf000d58da2c10
Contents?: true
Size: 976 Bytes
Versions: 2
Compression:
Stored size: 976 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(:attribute) { should be(object) } 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) } its(:attribute) { should be(object) } its(:value) { should be(default) } end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
virtus-0.2.0 | spec/unit/virtus/attribute/default_spec.rb |
virtus-0.1.0 | spec/unit/virtus/attribute/default_spec.rb |