Sha256: 6d3c15f85ebcbf9a1af67e0d568d8bfe0297858b23e679a1eb00815b46a75647

Contents?: true

Size: 747 Bytes

Versions: 11

Compression:

Stored size: 747 Bytes

Contents

# encoding: utf-8

require 'spec_helper'

describe Axiom::Types::Options, '#inherited' do
  subject { descendant }

  let(:object) do
    Class.new(ancestor) do
      extend Options, DescendantsTracker
      accept_options :primitive, :coerce_method
      primitive ::String
    end
  end

  let(:ancestor) do
    Class.new
  end

  let(:descendant) do
    Class.new(object)
  end

  it 'delegates to the ancestor' do
    expect(ancestor).to receive(:inherited).twice
    subject
  end

  it 'adds the accepted option to the descendant' do
    subject
    expect(descendant).to respond_to(:primitive, :coerce_method)
  end

  it 'sets the default value for the descendant' do
    subject
    expect(descendant.primitive).to be(::String)
  end
end

Version data entries

11 entries across 9 versions & 4 rubygems

Version Path
cm-admin-1.5.22 vendor/bundle/ruby/3.3.0/gems/axiom-types-0.1.1/spec/unit/axiom/types/options/inherited_spec.rb
cm-admin-1.5.21 vendor/bundle/ruby/3.3.0/gems/axiom-types-0.1.1/spec/unit/axiom/types/options/inherited_spec.rb
cm-admin-1.5.20 vendor/bundle/ruby/3.3.0/gems/axiom-types-0.1.1/spec/unit/axiom/types/options/inherited_spec.rb
grape-extra_validators-2.0.0 vendor/bundle/ruby/2.6.0/gems/axiom-types-0.1.1/spec/unit/axiom/types/options/inherited_spec.rb
grape-extra_validators-1.0.0 vendor/bundle/ruby/2.4.0/gems/axiom-types-0.1.1/spec/unit/axiom/types/options/inherited_spec.rb
config_gems_initialization_aim-0.1.4 vendor/bundle/ruby/2.5.0/gems/config_gems_initialization_aim-0.1.1/vendor/bundle/ruby/2.5.0/gems/axiom-types-0.1.1/spec/unit/axiom/types/options/inherited_spec.rb
config_gems_initialization_aim-0.1.4 vendor/bundle/ruby/2.5.0/gems/axiom-types-0.1.1/spec/unit/axiom/types/options/inherited_spec.rb
config_gems_initialization_aim-0.1.3 vendor/bundle/ruby/2.5.0/gems/config_gems_initialization_aim-0.1.1/vendor/bundle/ruby/2.5.0/gems/axiom-types-0.1.1/spec/unit/axiom/types/options/inherited_spec.rb
config_gems_initialization_aim-0.1.3 vendor/bundle/ruby/2.5.0/gems/axiom-types-0.1.1/spec/unit/axiom/types/options/inherited_spec.rb
axiom-types-0.1.1 spec/unit/axiom/types/options/inherited_spec.rb
axiom-types-0.1.0 spec/unit/axiom/types/options/inherited_spec.rb