Sha256: a9e60da6f933d0132dc3439314e9f38061f9e0f4c2a27fd35e633c7d8e827b44

Contents?: true

Size: 562 Bytes

Versions: 1

Compression:

Stored size: 562 Bytes

Contents

# -*- coding: utf-8 -*-

require File.dirname(__FILE__) + '/../../spec_helper'

describe Time do
  describe '#strict_parse' do
    context 'with valid date' do
      subject { Time.strict_parse("2012/09/27 11:45:00") }

      let(:expected) { Time.parse("2012/09/27 11:45:00") }

      it 'should be returned valid date' do
        expect(subject).to eql expected
      end
    end

    context 'with invalid date' do
      subject { Time.strict_parse("hoge") }

      it 'should be returned nil' do
        expect(subject).to be_nil
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
sysadmin-0.2.0 spec/lib/sysadmin/time_ext_spec.rb