Sha256: 00007b3c412befb3667b6b9bf18367602cd163d138c42003915c6be618283d27
Contents?: true
Size: 763 Bytes
Versions: 2
Compression:
Stored size: 763 Bytes
Contents
require 'spec_helper' describe Virtus::Attribute::DefaultValue, '#evaluate' do subject { object.evaluate(instance) } let(:object) { described_class.new(attribute, value) } let(:attribute) { Virtus::Attribute::String.new(:title) } let(:instance) { Class.new } context 'with a non-callable value' do context 'with a non-cloneable value' do let(:value) { nil } it { should eql(value) } end context 'with a cloneable value' do let(:value) { 'something' } it { should eql(value) } it { should_not equal(value) } end end context 'with a callable value' do let(:value) { lambda { |instance, attribute| attribute.name } } it { should be(:title) } end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
virtus-0.2.0 | spec/unit/virtus/attribute/default_value/instance_methods/evaluate_spec.rb |
virtus-0.1.0 | spec/unit/virtus/attribute/default_value/instance_methods/evaluate_spec.rb |