Sha256: 7ca940a62a9ef9172d9fbf8732409bdaa68a3367c546f843477be6c00f368a10

Contents?: true

Size: 602 Bytes

Versions: 3

Compression:

Stored size: 602 Bytes

Contents

require File.join(File.dirname(__FILE__), "..", "spec_helper")

describe SafeYAML::Transform::ToTime do
  # YAML don't parse times prior to 1.9.
  if RUBY_VERSION >= "1.9.2"
    it "returns true when the value matches a valid Time" do
      subject.transform?("2013-01-01 10:00:00")[0].should == true
    end
  end

  it "returns false when the value does not match a valid Time" do
    subject.transform?("not a time").should be_false
  end

  it "returns false when the beginning of a line does not match a Time" do
    subject.transform?("NOT A TIME\n2013-01-01 10:00:00").should be_false
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
safe_yaml-0.6.3 spec/transform/to_time_spec.rb
safe_yaml-0.6.2 spec/transform/to_time_spec.rb
safe_yaml-0.6.1 spec/transform/to_time_spec.rb