Permalink
Browse files

Add a spec for Virtus::Attribute::DefaultValue::FromClonable#evaluate

  • Loading branch information...
1 parent de97110 commit b55fdec96827ec5df8a5a1dc1d72a2d210e09caf @solnic committed Mar 15, 2012
Showing with 20 additions and 1 deletion.
  1. +20 −1 spec/unit/virtus/attribute/default_value/from_clonable/evaluate_spec.rb
@@ -1,5 +1,24 @@
require 'spec_helper'
describe Virtus::Attribute::DefaultValue::FromClonable, '#evaluate' do
- it 'should have spec'
+ subject { object.evaluate(instance) }
+
+ let(:object) { described_class.build(attribute, value) }
+ let(:attribute) { mock('attribute') }
+ let(:value) { mock('value') }
+ let(:instance) { mock('instance') }
+ let(:response) { mock('response') }
+ let(:clone) { mock('clone') }
+
+ before { value.stub(:clone => clone) }
+
+ specify { object.should be_instance_of(Virtus::Attribute::DefaultValue::FromClonable) }
+
+ it { should be(clone) }
+
+ it 'clones the value' do
+ value.should_receive(:clone).with(no_args)
+ subject
+ end
end
+

0 comments on commit b55fdec

Please sign in to comment.