Sha256: de541b0710df3d7268fdf818ae8b83896748be9114c5905c0940933dd3b1a5c0
Contents?: true
Size: 724 Bytes
Versions: 7
Compression:
Stored size: 724 Bytes
Contents
# frozen_string_literal: true RSpec.describe Necromancer::DateTimeConverters::StringToDateConverter, '.call' do subject(:converter) { described_class.new(:string, :date) } it "converts '1-1-2015' to date value" do expect(converter.call('1-1-2015')).to eq(Date.parse('2015/01/01')) end it "converts '2014/12/07' to date value" do expect(converter.call('2014/12/07')).to eq(Date.parse('2014/12/07')) end it "converts '2014-12-07' to date value" do expect(converter.call('2014-12-07')).to eq(Date.parse('2014/12/07')) end it "fails to convert in strict mode" do expect { converter.call('2014 - 12 - 07', strict: true) }.to raise_error(Necromancer::ConversionTypeError) end end
Version data entries
7 entries across 7 versions & 2 rubygems