Sha256: a0c080482d51ae9b5416e31697206851aa47862495ccc34bd3b3a858eb5a9daa

Contents?: true

Size: 1.34 KB

Versions: 53

Compression:

Stored size: 1.34 KB

Contents

require 'spec_helper'

describe Krikri::Enrichments::ParseDate do
  it_behaves_like 'a field enrichment'

  values = [{ :string => 'parses calendar to ruby Date',
              :start => 'May 15, 2014',
              :end => Date.parse('2014-05-15')
            },
            { :string => 'parses ISO to ruby Date',
              :start => '2014-05-15',
              :end => Date.parse('2014-05-15')
            },
            { :string => 'parses slash to ruby Date',
              :start => '5/7/2012',
              :end => Date.parse('2012-05-07')
            },
            { :string => 'parses dot to ruby Date',
              :start => '5.7.2012',
              :end => Date.parse('2012-05-07')
            },
            { :string => 'parses Month, Year to ruby Date',
              :start => 'July, 2015',
              :end => Date.parse('2015-07-01')
            },
            { :string => 'parses M-D-Y to ruby Date',
              :start => '12-19-2010',
              :end => Date.parse('2010-12-19')
            },
            { :string => 'parses uncertain to EDTF',
              :start => '2015?',
              :end => Date.edtf('2015?')
            },
            { :string => 'leaves other fields unaltered',
              :start => "moominpapa",
              :end => "moominpapa"
            }]

  it_behaves_like 'a string enrichment', values
end

Version data entries

53 entries across 53 versions & 1 rubygems

Version Path
krikri-0.15.2 spec/lib/krikri/enrichments/parse_date_spec.rb
krikri-0.15.1 spec/lib/krikri/enrichments/parse_date_spec.rb
krikri-0.15.0 spec/lib/krikri/enrichments/parse_date_spec.rb
krikri-0.14.0 spec/lib/krikri/enrichments/parse_date_spec.rb
krikri-0.13.2 spec/lib/krikri/enrichments/parse_date_spec.rb
krikri-0.13.1 spec/lib/krikri/enrichments/parse_date_spec.rb
krikri-0.13.0 spec/lib/krikri/enrichments/parse_date_spec.rb
krikri-0.12.4 spec/lib/krikri/enrichments/parse_date_spec.rb
krikri-0.12.3 spec/lib/krikri/enrichments/parse_date_spec.rb
krikri-0.12.1 spec/lib/krikri/enrichments/parse_date_spec.rb
krikri-0.12.0 spec/lib/krikri/enrichments/parse_date_spec.rb
krikri-0.12.0.pre.rc.1 spec/lib/krikri/enrichments/parse_date_spec.rb
krikri-0.11.2 spec/lib/krikri/enrichments/parse_date_spec.rb
krikri-0.11.1 spec/lib/krikri/enrichments/parse_date_spec.rb
krikri-0.11.0 spec/lib/krikri/enrichments/parse_date_spec.rb
krikri-0.10.1 spec/lib/krikri/enrichments/parse_date_spec.rb
krikri-0.10.0 spec/lib/krikri/enrichments/parse_date_spec.rb
krikri-0.9.0 spec/lib/krikri/enrichments/parse_date_spec.rb
krikri-0.8.9 spec/lib/krikri/enrichments/parse_date_spec.rb
krikri-0.8.8 spec/lib/krikri/enrichments/parse_date_spec.rb