Sha256: 34ed1521c1278cd9c4739cbbf40a32763e0591f5725e1e4f8edc2449883bb626

Contents?: true

Size: 620 Bytes

Versions: 7

Compression:

Stored size: 620 Bytes

Contents

# frozen_string_literal: true

RSpec.describe Necromancer::BooleanConverters::BooleanToIntegerConverter, '.call' do

  subject(:converter) { described_class.new }

  it "converts true to 1 value" do
    expect(converter.call(true)).to eq(1)
  end

  it "converts false to 0 value" do
    expect(converter.call(false)).to eq(0)
  end

  it "fails to convert in strict mode" do
    expect {
      converter.call('unknown', strict: true)
    }.to raise_error(Necromancer::ConversionTypeError)
  end

  it "returns value in non-strict mode" do
    expect(converter.call('unknown', strict: false)).to eq('unknown')
  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/converters/boolean/boolean_to_integer_spec.rb
pokedex-terminal-0.2.7 vendor/bundle/ruby/2.7.0/gems/necromancer-0.5.1/spec/unit/converters/boolean/boolean_to_integer_spec.rb
pokedex-terminal-0.2.6 vendor/bundle/ruby/2.7.0/gems/necromancer-0.5.1/spec/unit/converters/boolean/boolean_to_integer_spec.rb
pokedex-terminal-0.2.5 vendor/bundle/ruby/2.7.0/gems/necromancer-0.5.1/spec/unit/converters/boolean/boolean_to_integer_spec.rb
pokedex-terminal-0.2.4 vendor/bundle/ruby/2.7.0/gems/necromancer-0.5.1/spec/unit/converters/boolean/boolean_to_integer_spec.rb
necromancer-0.5.1 spec/unit/converters/boolean/boolean_to_integer_spec.rb
necromancer-0.5.0 spec/unit/converters/boolean/boolean_to_integer_spec.rb