Sha256: c6622b8f3de07ec352697a1e5d8792c87dc0171a3df9598468409dbc12902b81

Contents?: true

Size: 678 Bytes

Versions: 9

Compression:

Stored size: 678 Bytes

Contents

require "spec_helper"
require "active_support/core_ext/numeric/time"

describe Pliny::Helpers::ZuluTime do
  context "zulu_time" do
    class ZuluTimeTest
      extend Pliny::Helpers::ZuluTime
    end

    it "it formats Time instances" do
      formatted = ZuluTimeTest.zulu_time(Time.parse("2017-11-28T21:49:52.123+00:00"))
      assert_equal "2017-11-28T21:49:52Z", formatted
    end

    it "it formats DateTime instances" do
      formatted = ZuluTimeTest.zulu_time(DateTime.parse("2017-11-28T21:49:52.123+00:00"))
      assert_equal "2017-11-28T21:49:52Z", formatted
    end

    it "when called with nil" do
      assert_nil ZuluTimeTest.zulu_time(nil)
    end
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
pliny-0.32.0 spec/helpers/zulu_time_spec.rb
pliny-0.31.0 spec/helpers/zulu_time_spec.rb
pliny-0.30.1 spec/helpers/zulu_time_spec.rb
pliny-0.30.0 spec/helpers/zulu_time_spec.rb
pliny-0.29.0 spec/helpers/zulu_time_spec.rb
pliny-0.28.0 spec/helpers/zulu_time_spec.rb
pliny-0.27.1 spec/helpers/zulu_time_spec.rb
pliny-0.27.0 spec/helpers/zulu_time_spec.rb
pliny-0.26.2 spec/helpers/zulu_time_spec.rb