Sha256: ac3c1e29c5bdbc0049212140a1884243d0bae11945e66339f16932dd350d01ba

Contents?: true

Size: 475 Bytes

Versions: 12

Compression:

Stored size: 475 Bytes

Contents

require 'spec_helper'

describe Virtus, '#set_default_attributes!' do
  subject { object.set_default_attributes! }

  let(:model) {
    Class.new {
      include Virtus

      attribute :name, String,  :default => 'foo', :lazy => true
      attribute :age,  Integer, :default => 30
    }
  }

  let(:object) { model.new }

  before do
    object.set_default_attributes!
  end

  it { should be(object) }

  its(:name) { should eql('foo') }
  its(:age)  { should be(30) }
end

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
virtus-1.0.3 spec/unit/virtus/set_default_attributes_spec.rb
virtus-1.0.2 spec/unit/virtus/set_default_attributes_spec.rb
virtus-1.0.1 spec/unit/virtus/set_default_attributes_spec.rb
virtus-1.0.0 spec/unit/virtus/set_default_attributes_spec.rb
virtus-1.0.0.rc2 spec/unit/virtus/set_default_attributes_spec.rb
virtus-1.0.0.rc1 spec/unit/virtus/set_default_attributes_spec.rb
virtus-1.0.0.beta8 spec/unit/virtus/set_default_attributes_spec.rb
virtus-1.0.0.beta7 spec/unit/virtus/set_default_attributes_spec.rb
virtus-1.0.0.beta6 spec/unit/virtus/set_default_attributes_spec.rb
virtus-1.0.0.beta5 spec/unit/virtus/set_default_attributes_spec.rb
virtus-1.0.0.beta4 spec/unit/virtus/set_default_attributes_spec.rb
virtus-1.0.0.beta3 spec/unit/virtus/set_default_attributes_spec.rb