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

Make :as option also set request format (AC::TestCase) #26573

Merged
merged 1 commit into from Sep 27, 2016
Merged

Make :as option also set request format (AC::TestCase) #26573

merged 1 commit into from Sep 27, 2016

Conversation

@kirs
Copy link
Member

@kirs kirs commented Sep 21, 2016

We introduced as: option in #26212 and it's supposed to also set format when it's blank:

if as
  @request.content_type = Mime[as].to_s
  format ||= as
end

But right now we assign format before this block of code so format ||= as will always be ignored.

Counting that, now you'd always have to specify both :as and :format:

post :create, params: { foo: "bar" } as: :json, format: :json

But with my patch, :format will also be set to json when as is supplied.

post :create, params: { foo: "bar" } as: :json

review @rafaelfranca

right now you'd have to specify both :as and :format:

```
post :create, params: { foo: "bar" } as: :json, format: :json
```
@rails-bot
Copy link

@rails-bot rails-bot commented Sep 21, 2016

r? @eileencodes

(@rails-bot has picked a reviewer for you, use r? to override)

@rafaelfranca rafaelfranca merged commit ebcd965 into rails:master Sep 27, 2016
2 checks passed
2 checks passed
codeclimate Code Climate didn't find any new or fixed issues.
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details
rafaelfranca added a commit that referenced this pull request Sep 27, 2016
Make :as option also set request format (AC::TestCase)
@rafaelfranca
Copy link
Member

@rafaelfranca rafaelfranca commented Sep 27, 2016

Backported in d8e311f

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

Successfully merging this pull request may close these issues.

None yet

5 participants