Sha256: b45256c1213fa0e3b7649b432cb6e1d844d3a7815d0053f527e4b78da201bbe5
Contents?: true
Size: 816 Bytes
Versions: 7
Compression:
Stored size: 816 Bytes
Contents
# frozen_string_literal: true RSpec.describe Necromancer::RangeConverters::StringToRangeConverter, '.call' do subject(:converter) { described_class.new } it "raises error for empty string in strict mode" do expect { converter.call('', strict: true) }.to raise_error(Necromancer::ConversionTypeError) end it "returns value in non-strict mode" do expect(converter.call('', strict: false)).to eq('') end { '1' => 1..1, '1..10' => 1..10, '1-10' => 1..10, '1,10' => 1..10, '1...10' => 1...10, '-1..10' => -1..10, '1..-10' => 1..-10, 'a..z' => 'a'..'z', 'a-z' => 'a'..'z', 'A-Z' => 'A'..'Z' }.each do |actual, expected| it "converts '#{actual}' to range type" do expect(converter.call(actual)).to eql(expected) end end end
Version data entries
7 entries across 7 versions & 2 rubygems