Sha256: d0e35007ff034235e42d65cfda423397678a97ef49308a577f1fa93b15125b05
Contents?: true
Size: 700 Bytes
Versions: 7
Compression:
Stored size: 700 Bytes
Contents
# frozen_string_literal: true RSpec.describe Necromancer::ArrayConverters::ArrayToBooleanConverter, '.call' do subject(:converter) { described_class.new(:array, :boolean) } it "converts `['t', 'f', 'yes', 'no']` to boolean array" do expect(converter.call(['t', 'f', 'yes', 'no'])).to eq([true, false, true, false]) end it "fails to convert `['t', 'no', 5]` to boolean array in strict mode" do expect { converter.call(['t', 'no', 5], strict: true) }.to raise_error(Necromancer::ConversionTypeError) end it "converts `['t', 'no', 5]` to boolean array in non-strict mode" do expect(converter.call(['t', 'no', 5], strict: false)).to eql([true, false, 5]) end end
Version data entries
7 entries across 7 versions & 2 rubygems