Sha256: b0b6928855cc6f78dbbbb91c696bb3c0d7abd37cfad53bea41b993808deb99d4

Contents?: true

Size: 619 Bytes

Versions: 9

Compression:

Stored size: 619 Bytes

Contents

require 'spec_helper'

describe Virtus::Attribute::DefaultValue, '.build' do
  subject { described_class.build(default) }

  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

Version data entries

9 entries across 9 versions & 2 rubygems

Version Path
virtus-0.5.5 spec/unit/virtus/attribute/default_value/class_methods/build_spec.rb
virtus-0.5.4 spec/unit/virtus/attribute/default_value/class_methods/build_spec.rb
virtus-0.5.3 spec/unit/virtus/attribute/default_value/class_methods/build_spec.rb
fragrant-0.0.5 vendor/bundle/ruby/1.9.1/gems/virtus-0.5.2/spec/unit/virtus/attribute/default_value/class_methods/build_spec.rb
virtus-0.5.2 spec/unit/virtus/attribute/default_value/class_methods/build_spec.rb
virtus-0.5.1 spec/unit/virtus/attribute/default_value/class_methods/build_spec.rb
virtus-0.5.0 spec/unit/virtus/attribute/default_value/class_methods/build_spec.rb
virtus-0.4.2 spec/unit/virtus/attribute/default_value/class_methods/build_spec.rb
virtus-0.4.1 spec/unit/virtus/attribute/default_value/class_methods/build_spec.rb