I have a very simple functional test for a controller, but I need to
set a header field in the request before the invocation of the action,
but the headers seem to be getting reset, even though I’m not doing
multiple requests. Is this not how functional tests are to be used?
test “test the show requires system header” do
@request.headers[“System-Name”] = “Test System”
get :show
assert_response :success
…
end
The controller doesn’t return a success unless the header is set, so
it fails immediately.
Is there another idiom that’s more appropriate?