0
我有以下代碼訪問on Rails的控制器中的 「請求」 變量測試
require 'test_helper'
class ApplicationControllerTest < ActionController::TestCase
test "should display the page in german" do
get :index
assert_response :success
# ...
request.env["HTTP_REFERER"] = :index
# ...
end
end
如果我運行該軌道的功能測試與
$ rake test:functionals
我得到這個錯誤:
test_should_display_the_page_in_german(ApplicationControllerTest):
NameError: undefined local variable or method `request' for #<ApplicationControllerTest:0x1044c6d00>
我如何訪問「請求」變量?