My integration test looks like this:
class OAuthTest < ActionDispatch::IntegrationTest
...
@client = OAuth2::Client.new(
client_id,
client_secret,
{ :site => 'https://provider', :token_url => '/oauth/access_token' }
)
@client.connection.build do |b|
b.adapter :action_dispatch, self
end
access_token = @client.auth_code.get_token(...)
access_token.get("/user.json")
And with Faraday 0.7.6 it works just fine, the action_dispatch adapter will route the http request to my Rails app (calling the users_controller). But with Faraday 0.8.0 the action_dispatch adapter was replaced by the rack (see https://github.com/technoweenie/faraday/pull/134) and I cannot make it work.
I think I need to change the above code to this:
@client.connection.build do |b|
b.adapter :rack, self.app
end
But it fails at Rack (1.2.5) expecting a Stream, but it gets a Hash and says undefined read method for Hash at line 149 (here: https://github.com/rack/rack/blob/1.2.5/lib/rack/request.rb#L149).
How can I make this work?
You will need to add the middleware url_encoded to make this work;