Sha256: dcc4398d7e4680109308d83d52496fbe7079f023dffe0faff38549748016f357

Contents?: true

Size: 687 Bytes

Versions: 10

Compression:

Stored size: 687 Bytes

Contents

require 'spec_helper'

describe Virtus::Options, '#options' do
  subject { object.options }

  let(:object) do
    Class.new do
      extend Virtus::Options, Virtus::DescendantsTracker
    end
  end

  context 'with an option that has a default value' do
    let(:default_value) { stub('default_value') }

    before do
      object.accept_options :name
      object.name default_value
    end

    it { should be_instance_of(Hash) }

    it { should eql(:name => default_value) }
  end

  context 'with an option that does not have a default value' do
    before do
      object.accept_options :name
    end

    it { should be_instance_of(Hash) }

    it { should be_empty }
  end
end

Version data entries

10 entries across 10 versions & 2 rubygems

Version Path
fragrant-0.0.5 vendor/bundle/ruby/1.9.1/gems/virtus-0.5.2/spec/unit/virtus/options/options_spec.rb
virtus-0.5.2 spec/unit/virtus/options/options_spec.rb
virtus-0.5.1 spec/unit/virtus/options/options_spec.rb
virtus-0.5.0 spec/unit/virtus/options/options_spec.rb
virtus-0.4.2 spec/unit/virtus/options/options_spec.rb
virtus-0.4.1 spec/unit/virtus/options/options_spec.rb
virtus-0.4.0 spec/unit/virtus/options/options_spec.rb
virtus-0.3.0 spec/unit/virtus/options/options_spec.rb
virtus-0.2.0 spec/unit/virtus/options/options_spec.rb
virtus-0.1.0 spec/unit/virtus/options/options_spec.rb