Sha256: a481c78977343faf3cf4702d672fab08bc2317a6e8f79768f95e5d59946b66de

Contents?: true

Size: 518 Bytes

Versions: 6

Compression:

Stored size: 518 Bytes

Contents

require 'spec_helper'
require 'parameters/types/date_time'

describe Parameters::Types::DateTime do
  subject { described_class }

  describe "coerce" do
    let(:string)    { '2010-02-18T00:36:31-08:00' }
    let(:time)      { Time.parse(string)          }
    let(:date_time) { DateTime.parse(string)      }

    it "should call #to_datetime when possible" do
      subject.coerce(time).should == date_time
    end

    it "should parse Strings" do
      subject.coerce(string).should == date_time
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
parameters-0.4.4 spec/types/date_time_spec.rb
parameters-0.4.3 spec/types/date_time_spec.rb
parameters-0.4.2 spec/types/date_time_spec.rb
parameters-0.4.0 spec/types/date_time_spec.rb
parameters-0.3.1 spec/types/date_time_spec.rb
parameters-0.3.0 spec/types/date_time_spec.rb