Skip to content

Commit

Permalink
Convert intended usage of Time.new to Time.utc in specs
Browse files Browse the repository at this point in the history
  • Loading branch information
straight-shoota committed Nov 24, 2017
1 parent 3006b61 commit 89d89c6
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 11 deletions.
2 changes: 1 addition & 1 deletion spec/std/gzip/gzip_spec.cr
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ describe Gzip do
it "writes and reads to memory" do
io = IO::Memory.new

time = Time.new(2016, 1, 2)
time = Time.utc(2016, 1, 2)
os = 4_u8
extra = Bytes[1, 2, 3]
name = "foo.txt"
Expand Down
10 changes: 5 additions & 5 deletions spec/std/http/cookie_spec.cr
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ module HTTP

it "parses expires rfc1123" do
cookie = parse_set_cookie("key=value; expires=Sun, 06 Nov 1994 08:49:37 GMT")
time = Time.new(1994, 11, 6, 8, 49, 37)
time = Time.utc(1994, 11, 6, 8, 49, 37)

cookie.name.should eq("key")
cookie.value.should eq("value")
Expand All @@ -106,7 +106,7 @@ module HTTP

it "parses expires rfc1036" do
cookie = parse_set_cookie("key=value; expires=Sunday, 06-Nov-94 08:49:37 GMT")
time = Time.new(1994, 11, 6, 8, 49, 37)
time = Time.utc(1994, 11, 6, 8, 49, 37)

cookie.name.should eq("key")
cookie.value.should eq("value")
Expand All @@ -115,7 +115,7 @@ module HTTP

it "parses expires ansi c" do
cookie = parse_set_cookie("key=value; expires=Sun Nov 6 08:49:37 1994")
time = Time.new(1994, 11, 6, 8, 49, 37)
time = Time.utc(1994, 11, 6, 8, 49, 37)

cookie.name.should eq("key")
cookie.value.should eq("value")
Expand All @@ -124,12 +124,12 @@ module HTTP

it "parses expires ansi c, variant with zone" do
cookie = parse_set_cookie("bla=; expires=Thu, 01 Jan 1970 00:00:00 -0000")
cookie.expires.should eq(Time.new(1970, 1, 1, 0, 0, 0))
cookie.expires.should eq(Time.utc(1970, 1, 1, 0, 0, 0))
end

it "parses full" do
cookie = parse_set_cookie("key=value; path=/test; domain=www.example.com; HttpOnly; Secure; expires=Sun, 06 Nov 1994 08:49:37 GMT")
time = Time.new(1994, 11, 6, 8, 49, 37)
time = Time.utc(1994, 11, 6, 8, 49, 37)

cookie.name.should eq("key")
cookie.value.should eq("value")
Expand Down
10 changes: 5 additions & 5 deletions spec/std/http/http_spec.cr
Original file line number Diff line number Diff line change
Expand Up @@ -3,24 +3,24 @@ require "http"

describe HTTP do
it "parses RFC 1123" do
time = Time.new(1994, 11, 6, 8, 49, 37)
time = Time.utc(1994, 11, 6, 8, 49, 37)
HTTP.parse_time("Sun, 06 Nov 1994 08:49:37 GMT").should eq(time)
end

it "parses RFC 1123 without day name" do
time = Time.new(1994, 11, 6, 8, 49, 37)
time = Time.utc(1994, 11, 6, 8, 49, 37)
HTTP.parse_time("06 Nov 1994 08:49:37 GMT").should eq(time)
end

it "parses RFC 1036" do
time = Time.new(1994, 11, 6, 8, 49, 37)
time = Time.utc(1994, 11, 6, 8, 49, 37)
HTTP.parse_time("Sunday, 06-Nov-94 08:49:37 GMT").should eq(time)
end

it "parses ANSI C" do
time = Time.new(1994, 11, 6, 8, 49, 37)
time = Time.utc(1994, 11, 6, 8, 49, 37)
HTTP.parse_time("Sun Nov 6 08:49:37 1994").should eq(time)
time2 = Time.new(1994, 11, 16, 8, 49, 37)
time2 = Time.utc(1994, 11, 16, 8, 49, 37)
HTTP.parse_time("Sun Nov 16 08:49:37 1994").should eq(time2)
end

Expand Down

0 comments on commit 89d89c6

Please sign in to comment.