Skip to content
Browse files

Add spec for Virtus::Attribute::DefaultValue.build

  • Loading branch information...
1 parent 4e527b4 commit 732097186133d28b84458df7971a83a49df33f74 @solnic committed
Showing with 21 additions and 1 deletion.
  1. +21 −1 spec/unit/virtus/attribute/default_value/class_methods/build_spec.rb
View
22 spec/unit/virtus/attribute/default_value/class_methods/build_spec.rb
@@ -1,5 +1,25 @@
require 'spec_helper'
describe Virtus::Attribute::DefaultValue, '.build' do
- it 'should have spec'
+ subject { described_class.build(attribute, default) }
+
+ let(:attribute) { mock('attribute') }
+
+ context 'when default is a symbol' do
+ let(:default) { :symbol }
+
+ it { should be_instance_of(Virtus::Attribute::DefaultValue::FromSymbol) }
+ end
+
+ context 'when default is a callable' do
+ let(:default) { Proc.new {} }
+
+ it { should be_instance_of(Virtus::Attribute::DefaultValue::FromCallable) }
+ end
+
+ context 'when default is a clonable' do
+ let(:default) { "I can be cloned" }
+
+ it { should be_instance_of(Virtus::Attribute::DefaultValue::FromClonable) }
+ end
end

0 comments on commit 7320971

Please sign in to comment.
Something went wrong with that request. Please try again.