Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add ActionDispatch::Cookies middleware test with Rack::Lint #48827

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
16 changes: 16 additions & 0 deletions actionpack/test/dispatch/cookies_test.rb
Expand Up @@ -80,6 +80,22 @@ def test_write_doesnt_set_a_nil_header
end
end

class CookiesMiddlewareTest < ActiveSupport::TestCase
def test_sets_expected_cookie_header
request = ActionDispatch::Request.empty
request.cookie_jar[:foo] = "bar"
env = Rack::MockRequest.env_for("", request.env)

_status, headers, _body = Rack::Lint.new(
ActionDispatch::Cookies.new(
Rack::Lint.new(lambda { |_env| [ 200, {}, [] ] })
)
).call(env)

assert_equal "foo=bar; path=/", headers["set-cookie"]
end
end

class CookiesTest < ActionController::TestCase
include CookieAssertions

Expand Down