2017-03-17 46 views

回答

0

找到了一個解決方案。包括Rack::Test::Methods模塊。 我不知道爲什麼請求規範不提供此功能。

RSpec.describe "Users API", type: :request do 
    include Rack::Test::Methods 

    before :each do 
    host! "example.org" 
    // now we can do 
    header 'Authorization', "Bearer #{some_token}" 
    end 
end 
相關問題