Sha256: bc2ac31088abb2b4c9214668a3fd8c1e38b4882aed8aa1a8cdb4a6c310466fc3

Contents?: true

Size: 981 Bytes

Versions: 5

Compression:

Stored size: 981 Bytes

Contents

require 'spec_helper'

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

  let(:descendant) { Class.new(object) }
  let(:new_option) { :width }

  specify { object.should     respond_to(:accept_options) }
  specify { descendant.should respond_to(:accept_options) }

  before :all do
    object.accepted_options.should_not include(new_option)
    descendant.accepted_options.should_not include(new_option)
    object.accept_options(new_option)
  end

  it "sets new accepted options on itself" do
    object.accepted_options.should include(new_option)
  end

  it "sets new accepted option on its descendants" do
    descendant.accepted_options.should include(new_option)
  end

  it "creates option accessors" do
    object.should respond_to(new_option)
  end

  it "creates option accessors on descendant" do
    descendant.should respond_to(new_option)
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
virtus-0.0.10 spec/unit/virtus/options/accept_options_spec.rb
virtus-0.0.9 spec/unit/virtus/options/accept_options_spec.rb
virtus-0.0.8 spec/unit/virtus/options/accept_options_spec.rb
virtus-0.0.7 spec/unit/virtus/options/accept_options_spec.rb
virtus-0.0.6 spec/unit/virtus/options/accept_options_spec.rb