summaryrefslogtreecommitdiff
path: root/spec/rubyspec/library/time/httpdate_spec.rb
diff options
context:
space:
mode:
authoreregon <eregon@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2017-05-07 12:04:49 +0000
committereregon <eregon@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2017-05-07 12:04:49 +0000
commit95e8c48dd3348503a8c7db5d0498894a1b676395 (patch)
tree9eef7f720314ebaff56845a74e203770e62284e4 /spec/rubyspec/library/time/httpdate_spec.rb
parented7d803500de38186c74bce94d233e85ef51e503 (diff)
Add in-tree mspec and ruby/spec
* For easier modifications of ruby/spec by MRI developers. * .gitignore: track changes under spec. * spec/mspec, spec/rubyspec: add in-tree mspec and ruby/spec. These files can therefore be updated like any other file in MRI. Instructions are provided in spec/README. [Feature #13156] [ruby-core:79246] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58595 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'spec/rubyspec/library/time/httpdate_spec.rb')
-rw-r--r--spec/rubyspec/library/time/httpdate_spec.rb21
1 files changed, 21 insertions, 0 deletions
diff --git a/spec/rubyspec/library/time/httpdate_spec.rb b/spec/rubyspec/library/time/httpdate_spec.rb
new file mode 100644
index 0000000000..af3fd83608
--- /dev/null
+++ b/spec/rubyspec/library/time/httpdate_spec.rb
@@ -0,0 +1,21 @@
+require File.expand_path('../../../spec_helper', __FILE__)
+require 'time'
+
+describe "Time.httpdate" do
+ it "parses RFC-2616 strings" do
+ t = Time.utc(1994, 11, 6, 8, 49, 37)
+ t.should == Time.httpdate("Sun, 06 Nov 1994 08:49:37 GMT")
+
+ # relies on Time.parse (not yet implemented)
+ # t.should == Time.httpdate("Sunday, 06-Nov-94 08:49:37 GMT")
+
+ t.should == Time.httpdate("Sun Nov 6 08:49:37 1994")
+ Time.utc(1995, 11, 15, 6, 25, 24).should == Time.httpdate("Wed, 15 Nov 1995 06:25:24 GMT")
+ Time.utc(1995, 11, 15, 4, 58, 8).should == Time.httpdate("Wed, 15 Nov 1995 04:58:08 GMT")
+ Time.utc(1994, 11, 15, 8, 12, 31).should == Time.httpdate("Tue, 15 Nov 1994 08:12:31 GMT")
+ Time.utc(1994, 12, 1, 16, 0, 0).should == Time.httpdate("Thu, 01 Dec 1994 16:00:00 GMT")
+ Time.utc(1994, 10, 29, 19, 43, 31).should == Time.httpdate("Sat, 29 Oct 1994 19:43:31 GMT")
+ Time.utc(1994, 11, 15, 12, 45, 26).should == Time.httpdate("Tue, 15 Nov 1994 12:45:26 GMT")
+ Time.utc(1999, 12, 31, 23, 59, 59).should == Time.httpdate("Fri, 31 Dec 1999 23:59:59 GMT")
+ end
+end