Sha256: 7670953bd4ae6df0bdcc5383b2ae13c5d802c2306bcfc0f1605501684488d4a3

Contents?: true

Size: 722 Bytes

Versions: 3

Compression:

Stored size: 722 Bytes

Contents

require "spec_helper"

module Fonte
  module Parsers
    describe TemporalParser do
      let(:parser) { described_class.new }

      subject { parser.parse(date_time) }

      context "with a valid format" do
        let(:date_time) { "12/26/2011 - 02:14:29" }
        it { should be }

        subject { parser.parse(date_time).value }

        its(:day)   { should == 26 }
        its(:month) { should == 12 }
        its(:year)  { should == 2011 }
        its(:hour)  { should == 2 }
        its(:min)   { should == 14 }
        its(:sec)   { should == 29 }
      end

      context "with a invalid format" do
        let(:date_time) { "12/26/2011 02:14:29" }
        it { should_not be }
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
fonte-0.2.0 spec/parsers/temporal_parser_spec.rb
fonte-0.1.0 spec/parsers/temporal_parser_spec.rb
fonte-0.0.1 spec/parsers/temporal_parser_spec.rb