Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Compatibility with rspec-rails #70

Closed
colorfulfool opened this issue Aug 4, 2015 · 4 comments
Closed

Compatibility with rspec-rails #70

colorfulfool opened this issue Aug 4, 2015 · 4 comments

Comments

@colorfulfool
Copy link

Hi.

I am relatively new to Rails and probably doing something very stupid, but:
I use Rails with rspec, my tests have type: :request. When I call get, post, etc. in tests, what is actually called is ActionDispatch::Integration::Runner#get, not airbornes's get. Which leads to some unexpected results, like "Accept" being "text/html" by default and format: arg not working. What am I doing wrong?

@sethpollack
Copy link
Collaborator

You can add format: :json to your requests.

@sethpollack
Copy link
Collaborator

I use it for request specs all the time with no issues. I use config.infer_spec_type_from_file_location! rather than type: :request but i don't think that should make a difference.

@colorfulfool
Copy link
Author

Thanks for the reply. format: json does work when passed in params hash, but I found another workaround:

describe 'API for regular users' do
  def reset!
    super
    @integration_session.accept = 'application/json'
  end

@sethpollack
Copy link
Collaborator

ok awesome!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants