Skip to content

Commit 8821946

Browse files
authored
Merge pull request #2565 from Earlopain/spec-only-rack-class
Move spec-only helper class out of the rack namespace
2 parents 10128ad + c0f5f78 commit 8821946

File tree

1 file changed

+11
-8
lines changed

1 file changed

+11
-8
lines changed

spec/support/cookie_jar.rb

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,10 @@
11
# frozen_string_literal: true
22

33
require 'uri'
4-
5-
module Rack
6-
class MockResponse
7-
def cookie_jar
8-
@cookie_jar ||= Array(headers[Rack::SET_COOKIE]).flat_map { |h| h.split("\n") }.map { |c| Cookie.new(c).to_h }
9-
end
10-
4+
module Spec
5+
module Support
116
# https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Set-Cookie
12-
class Cookie
7+
class CookieJar
138
attr_reader :attributes
149

1510
def initialize(raw)
@@ -52,3 +47,11 @@ def parse_value(attribute, value)
5247
end
5348
end
5449
end
50+
51+
module Rack
52+
class MockResponse
53+
def cookie_jar
54+
@cookie_jar ||= Array(headers[Rack::SET_COOKIE]).flat_map { |h| h.split("\n") }.map { |c| Spec::Support::CookieJar.new(c).to_h }
55+
end
56+
end
57+
end

0 commit comments

Comments
 (0)