summaryrefslogtreecommitdiff
path: root/spec/ruby/library/cgi/cookie/expires_spec.rb
blob: df52a6f41e24748470d7eea98eb86ae089ab7cc8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
require_relative '../../../spec_helper'

ruby_version_is ""..."3.5" do
  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
end