Skip to content
Browse files

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

  • Loading branch information...
1 parent b55fdec commit 152485016ed10797d3394c629230ada900fd4c27 @solnic committed Mar 15, 2012
Showing with 14 additions and 1 deletion.
  1. +14 −1 spec/unit/virtus/attribute/default_value/from_symbol/evaluate_spec.rb
View
15 spec/unit/virtus/attribute/default_value/from_symbol/evaluate_spec.rb
@@ -1,5 +1,18 @@
require 'spec_helper'
describe Virtus::Attribute::DefaultValue::FromSymbol, '#evaluate' do
- it 'should have spec'
+ subject { object.evaluate(instance) }
+
+ let(:object) { described_class.new(attribute, value) }
+ let(:attribute) { mock('attribute') }
+ let(:instance) { mock('instance', value => retval) }
+ let(:value) { :set_default }
+ let(:retval) { mock('retval') }
+
+ it { should be(retval) }
+
+ it 'calls the method' do
+ instance.should_receive(value).with(no_args)
+ subject
+ end
end

1 comment on commit 1524850

@dkubb
Collaborator
dkubb commented on 1524850 Apr 2, 2012

@solnic what do you think about renaming this method, and the others from the sibling classes to .call ? In general that's the convention I used in veritas for similar types of objects and I think it fits nicely with ruby's calling convention for Proc objects.

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