Sha256: 91ec1a079d2ac4fb0db1806a1df88fe7cc895d2210ce4d3513200b5af61ee18d
Contents?: true
Size: 941 Bytes
Versions: 7
Compression:
Stored size: 941 Bytes
Contents
# frozen_string_literal: true RSpec.describe Necromancer::BooleanConverters::StringToBooleanConverter, '.call' do subject(:converter) { described_class.new(:string, :boolean) } it "raises error for empty string strict mode" do expect { converter.call('', strict: true) }.to raise_error(Necromancer::ConversionTypeError) end it "fails to convert unkonwn value FOO" do expect { converter.call('FOO', strict: true) }.to raise_error(Necromancer::ConversionTypeError) end it "passes through boolean value" do expect(converter.call(true)).to eq(true) end %w[true TRUE t T 1 y Y YES yes on ON].each do |value| it "converts '#{value}' to true value" do expect(converter.call(value)).to eq(true) end end %w[false FALSE f F 0 n N NO No no off OFF].each do |value| it "converts '#{value}' to false value" do expect(converter.call(value)).to eq(false) end end end
Version data entries
7 entries across 7 versions & 2 rubygems