aboutsummaryrefslogtreecommitdiffstats
path: root/spec/ruby/library/cgi/cookie/expires_spec.rb
diff options
context:
space:
mode:
Diffstat (limited to 'spec/ruby/library/cgi/cookie/expires_spec.rb')
-rw-r--r--spec/ruby/library/cgi/cookie/expires_spec.rb23
1 files changed, 23 insertions, 0 deletions
diff --git a/spec/ruby/library/cgi/cookie/expires_spec.rb b/spec/ruby/library/cgi/cookie/expires_spec.rb
new file mode 100644
index 0000000000..89f18fe071
--- /dev/null
+++ b/spec/ruby/library/cgi/cookie/expires_spec.rb
@@ -0,0 +1,23 @@
+require File.expand_path('../../../../spec_helper', __FILE__)
+require 'cgi'
+
+describe "CGI::Cookie#expires" do
+ it "returns self's expiration date" do
+ cookie = CGI::Cookie.new("test-cookie")
+ cookie.expires.should be_nil
+
+ cookie = CGI::Cookie.new("name" => "test-cookie", "expires" => Time.at(1196524602))
+ cookie.expires.should == Time.at(1196524602)
+ end
+end
+
+describe "CGI::Cookie#expires=" do
+ it "sets self's expiration date" do
+ cookie = CGI::Cookie.new("test-cookie")
+ cookie.expires = Time.at(1196524602)
+ cookie.expires.should == Time.at(1196524602)
+
+ cookie.expires = Time.at(1196525000)
+ cookie.expires.should == Time.at(1196525000)
+ end
+end