Sha256: b49c4fd5015517433a758178f7a2e17af44882dfa5e789945c0b1d4bfab2ef32
Contents?: true
Size: 691 Bytes
Versions: 7
Compression:
Stored size: 691 Bytes
Contents
# frozen_string_literal: true RSpec.describe Necromancer::ArrayConverters::ArrayToNumericConverter, '.call' do subject(:converter) { described_class.new(:array, :numeric) } it "converts `['1','2.3','3.0']` to numeric array" do expect(converter.call(['1', '2.3', '3.0'])).to eq([1, 2.3, 3.0]) end it "fails to convert `['1','2.3',false]` to numeric array in strict mode" do expect { converter.call(['1', '2.3', false], strict: true) }.to raise_error(Necromancer::ConversionTypeError) end it "converts `['1','2.3',false]` to numeric array in non-strict mode" do expect(converter.call(['1', '2.3', false], strict: false)).to eq([1, 2.3, false]) end end
Version data entries
7 entries across 7 versions & 2 rubygems