测试 RSpec 在 controller 测试 post get 方法 调用时, 怎么设置 headers ??

rogerluo410 · February 22, 2016 · Last by angelfan replied at February 22, 2016 · 3528 hits

post ”url“, params

params 是 body 里的参数 那么,怎么设置 header 里的参数?

例子:

describe "POST url" do
   let(:params) do
   {
     token: @valid_token,
     name: "p10"
   }
   end 
   it "测试api" do 
     post "/api/v1...", params  

     expect(last_response.status).to eq(201)
   end
 end 

在线等呀!!!

rspec 在 controller 测试 post get 方法 调用时,怎么设置 headers => rspec when controller test post get method call, how to set headers 把中文用 google 翻译成英文 然后再贴到 google 里搜索 http://stackoverflow.com/questions/9654465/how-to-set-request-headers-in-rspec-request-spec

You need to Sign in before reply, if you don't have an account, please Sign up first.