Sha256: 9add63e9b1fc09db0711524aed9d454a49b89e61b9f58e6142c636e7b18fa256
Contents?: true
Size: 897 Bytes
Versions: 14
Compression:
Stored size: 897 Bytes
Contents
require File.expand_path("../spec_helper", __dir__) require "search_flip/to_json" RSpec.describe "to_json" do it "uses the correct format for Time" do Timecop.freeze Time.parse("2018-01-01 12:00:00 UTC") do expect(Time.now.utc.to_json).to eq("\"2018-01-01T12:00:00.000000Z\"") end end it "uses the correct format for Date" do Timecop.freeze Time.parse("2018-01-01 12:00:00 UTC") do expect(Date.today.to_json).to eq("\"2018-01-01\"") end end it "uses the correct format for DateTime" do Timecop.freeze Time.parse("2018-01-01 12:00:00 UTC") do expect(Time.now.utc.to_json).to eq("\"2018-01-01T12:00:00.000000Z\"") end end it "uses the correct format for TimeWithZone" do Timecop.freeze Time.parse("2018-01-01 12:00:00 UTC") do expect(Time.find_zone("UTC").now.to_json).to eq("\"2018-01-01T12:00:00.000000Z\"") end end end
Version data entries
14 entries across 14 versions & 1 rubygems