2014-03-26 36 views
1
@request.headers["Authorization"] = "Token token=#{auth_token}" 
post "/verify" 

當我puts @request.inspect唯一的頭我看到的是:Rails的集成測試頭沒有被設置

..."action_controller.instance"=> 
#<VerificationsController:0x007fc5683ebd38 @_routes=nil, 
@_action_has_layout=true, 
@_headers={"Content-Type"=>"text/html"}... 

爲什麼我的授權頭不顯示?

回答

3

我最終得到這個工作:

headers = { 'Authorization' => "Token token=\"#{auth_token}\"" } 
json_body = {} 
post "api/1.1/cartwheelregister/verify/answers", json_body, headers 
+0

顯然前者語法不爲IntegrationTests工作... –