Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8212327
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T10:43:05+00:00 2026-06-07T10:43:05+00:00

My integration test looks like this: class OAuthTest < ActionDispatch::IntegrationTest … @client = OAuth2::Client.new(

  • 0

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?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-07T10:43:07+00:00Added an answer on June 7, 2026 at 10:43 am

    You will need to add the middleware url_encoded to make this work;

    @oauth = OAuth2::Client.new('client_id', 'client_secret') do |b|
      b.request :url_encoded
      b.adapter :rack, Rails.application
    end
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm doing integration testing of record creation with Cucumber. My feature looks like this:
My application I have an application design that looks like this: web application layer
I'm trying to create automated integration tests for this hardware+software test subject which runs
I would like to write some integration test for my application. I wasn't able
i've got an integration test that grabs some json result from a 3rd party
I have to write integration test case for my one feature listing page and
The following is pseudo code of an integration test that is failing: [Test] void
I have a problem with an integration test I am writing. I need to
Say there are multiple requests in a integration test, some of them are local
I'm trying to perform an integration test via Watir and RSpec . So, I

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.