Sha256: bd14b3c70ba9bd160c50a36f242cd8baae2435926ae8319267516d8e666fc796

Contents?: true

Size: 803 Bytes

Versions: 7

Compression:

Stored size: 803 Bytes

Contents

# frozen_string_literal: true

RSpec.describe Necromancer, 'config' do
  it "configures global settings per instance" do
    converter = described_class.new

    converter.configure do |config|
      config.strict false
    end
    expect(converter.convert("1.2.3").to(:array)).to eq(["1.2.3"])

    converter.configure do |config|
      config.strict true
    end
    expect {
      converter.convert("1.2.3").to(:array)
    }.to raise_error(Necromancer::ConversionTypeError)
  end

  it "configures global settings through instance block" do
    converter = described_class.new do |config|
      config.strict true
    end
    expect(converter.configuration.strict).to eq(true)

    expect {
      converter.convert("1.2.3").to(:array)
    }.to raise_error(Necromancer::ConversionTypeError)
  end
end

Version data entries

7 entries across 7 versions & 2 rubygems

Version Path
pokedex-terminal-0.2.8 vendor/bundle/ruby/2.7.0/gems/necromancer-0.5.1/spec/unit/config_spec.rb
pokedex-terminal-0.2.7 vendor/bundle/ruby/2.7.0/gems/necromancer-0.5.1/spec/unit/config_spec.rb
pokedex-terminal-0.2.6 vendor/bundle/ruby/2.7.0/gems/necromancer-0.5.1/spec/unit/config_spec.rb
pokedex-terminal-0.2.5 vendor/bundle/ruby/2.7.0/gems/necromancer-0.5.1/spec/unit/config_spec.rb
pokedex-terminal-0.2.4 vendor/bundle/ruby/2.7.0/gems/necromancer-0.5.1/spec/unit/config_spec.rb
necromancer-0.5.1 spec/unit/config_spec.rb
necromancer-0.5.0 spec/unit/config_spec.rb