<commit_before>require File.expand_path("helper", File.dirname(__FILE__))

test "set cookie" do
  Cuba.define do
    on default do
      res.set_cookie("foo", "bar")
      res.set_cookie("bar", "baz")
      res.write "Hello"
    end
  end

  env = { "SCRIPT_NAME" => "/", "PATH_INFO" => "/" }

   _, headers, body = Cuba.call(env)

   assert_equal "foo=bar\nbar=baz", headers["Set-Cookie"]
end

test "delete cookie" do
  Cuba.define do
    on default do
      res.set_cookie("foo", "bar")
      res.delete_cookie("foo")
      res.write "Hello"
    end
  end

  env = { "SCRIPT_NAME" => "/", "PATH_INFO" => "/" }

   _, headers, body = Cuba.call(env)

   assert_equal "foo=; max-age=0; expires=Thu, 01 Jan 1970 00:00:00 -0000",
     headers["Set-Cookie"]
end<commit_msg>Use a less strict test for deleting cookies<commit_after>require File.expand_path("helper", File.dirname(__FILE__))

test "set cookie" do
  Cuba.define do
    on default do
      res.set_cookie("foo", "bar")
      res.set_cookie("bar", "baz")
      res.write "Hello"
    end
  end

  env = { "SCRIPT_NAME" => "/", "PATH_INFO" => "/" }

   _, headers, body = Cuba.call(env)

   assert_equal "foo=bar\nbar=baz", headers["Set-Cookie"]
end

test "delete cookie" do
  Cuba.define do
    on default do
      res.set_cookie("foo", "bar")
      res.delete_cookie("foo")
      res.write "Hello"
    end
  end

  env = { "SCRIPT_NAME" => "/", "PATH_INFO" => "/" }

   _, headers, body = Cuba.call(env)

   assert /foo=; (max-age=0; )?expires=Thu, 01[ -]Jan[ -]1970 00:00:00 (-0000|GMT)/ =~
     headers["Set-Cookie"]
end
{'fraction_non_alphanumeric': 0.17289423685877137, 'fraction_numerical': 0.021532615579480684, 'mean_word_length': 3.0203562340966923, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 11, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6909481', 'n_tokens_mistral': 618, 'n_tokens_neox': 572, 'n_words': 132}