Sha256: 5757923f8cc5f153e0febb1b554e2b719539434a08eec9b8e5c94079c377d127

Contents?: true

Size: 599 Bytes

Versions: 7

Compression:

Stored size: 599 Bytes

Contents

describe "options tolerance" do
  before do
    class Test::Foo
      extend Dry::Initializer::Mixin
    end

    class Test::Bar < Test::Foo
      tolerant_to_unknown_options
    end

    class Test::Baz < Test::Bar
      intolerant_to_unknown_options
    end
  end

  it "is strict by default" do
    expect { Test::Foo.new foo: :bar }.to raise_error(ArgumentError)
  end

  it "allows unknown options when switched on" do
    expect { Test::Bar.new foo: :bar }.not_to raise_error
  end

  it "can be switched off" do
    expect { Test::Baz.new foo: :bar }.to raise_error(ArgumentError)
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
dry-initializer-0.7.0 spec/dry/options_tolerance_spec.rb
dry-initializer-0.6.0 spec/dry/options_tolerance_spec.rb
dry-initializer-0.5.0 spec/dry/options_tolerance_spec.rb
dry-initializer-0.4.0 spec/dry/options_tolerance_spec.rb
dry-initializer-0.3.3 spec/dry/options_tolerance_spec.rb
dry-initializer-0.3.2 spec/dry/options_tolerance_spec.rb
dry-initializer-0.3.1 spec/dry/options_tolerance_spec.rb