spec/unit/virtus/attribute/string_spec.rb in virtus-0.0.5 vs spec/unit/virtus/attribute/string_spec.rb in virtus-0.0.6
- old
+ new
@@ -1,19 +1,21 @@
require 'spec_helper'
describe Virtus::Attribute::String do
it_should_behave_like 'Attribute' do
- let(:attribute_name) { :email }
- let(:attribute_value) { 'red john' }
- let(:attribute_value_other) { :'red john' }
+ let(:attribute_name) { :email }
+ let(:attribute_value) { 'red john' }
+ let(:attribute_value_other) { :'red john' }
+ let(:attribute_default) { '' }
+ let(:attribute_default_proc) { lambda { |instance, attribute| attribute.name == :email } }
end
- describe '#typecast' do
- let(:attribute) { Virtus::Attribute::String.new(:name) }
+ describe '#coerce' do
+ let(:attribute) { described_class.new(:name) }
let(:value) { 1 }
- let(:typecast_value) { '1' }
+ let(:coerce_value) { '1' }
- subject { attribute.typecast(value) }
+ subject { attribute.coerce(value) }
- it { should eql(typecast_value) }
+ it { should eql(coerce_value) }
end
end