| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
|
| |
This image has copyright that we are not giving so it is better to use
one image that we own the copyright.
|
|
|
|
|
|
| |
This reverts commit 5dde413e1d14c42eb87071db20d075a7b962cb01.
Reason: The gem defines it so we don't need to remove
|
|
|
|
|
|
| |
`ActionDispatch::IntegrationTest`,
`#process`, `#get`, `#post`, `#patch`, `#put`, `#delete`, and `#head`.
|
| |
|
| |
|
|
|
|
|
| |
assigns assert the state of a controller instance what should not be
done in an integration test.
|
|
|
|
|
|
|
|
|
| |
Currently, `fixture_file_upload` does not work in integration test.
Because, `TestProcess` module has been include in `Session` class, but
`fixture_path` can not get from `Session` class.
Modify to include `TestProcess` in `IntegrationTest` class in order to get
correct value of `fixture_path`.
|
|
|
|
|
|
|
|
| |
Style/SpaceBeforeBlockBraces
Style/SpaceInsideBlockBraces
Style/SpaceInsideHashLiteralBraces
Fix all violations in the repository.
|
|
|
|
|
|
|
|
|
| |
A few have been left for aesthetic reasons, but have made a pass
and removed most of them.
Note that if the method `foo` returns an array, `foo << 1`
is a regular push, nothing to do with assignments, so
no self required.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
In integration test when specify the "Accept" header with "xhr: true"
option, the Accept header is overridden with a default xhr Accept
header. The issue only affects HTTP header "Accept" but not CGI variable
"HTTP_ACCEPT".
For example:
get '/page', headers: { 'Accept' => 'application/json' }, xhr: true
# This is WRONG! And the response.content_type is also affected.
# It should be "application/json"
assert_equal "text/javascript, text/html, ...", request.accept
assert_equal 'text/html', response.content_type
The issue is in `ActionDispatch::Integration::RequestHelpers`. When
setting "xhr: true" the helper sets a default HTTP_ACCEPT if blank.
But the code doesn't consider supporting both HTTP header style and
CGI variable style.
For detail see this GitHub issue:
https://github.com/rails/rails/issues/25859
|
| |
|
| |
|
|
|
|
|
| |
The current code base is not uniform. After some discussion,
we have chosen to go with double quotes by default.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
When a `GET` request is sent `as: :json` in an integration test the test
should use Rack's method override to change to a post request so the
paramters are included in the postdata. Otherwise it will not encode the
parameters correctly for the integration test.
Because integration test sets up it's own middleware,
`Rack::MethodOverride` needs to be included in the integration tests as
well.
`headers ||= {}` was moved so that headers are never nil. They should
default to a hash.
Fixes #26033
[Eileen M. Uchitelle & Aaron Patterson]
|
| |
|
| |
|
| |
|
|
|
|
| |
Fixes #25926
|
|
|
|
|
|
|
|
| |
Currently, if path is a relative path, add format without the discrimination of the query.
Therefore, if there is a query, format at end of the query would been added,
format was not be specified correctly.
This fix add format to end of path rather than query.
|
|
|
|
|
| |
Was worried the `as` might impede on users doing the long form
JSON response encoding; test for certainty.
|
|
|
|
|
|
|
|
| |
- Followup of https://github.com/rails/rails/issues/18693.
- I think we missed deprecating `request_via_redirect` in that pull
request.
- Originally requested by DHH here
https://github.com/rails/rails/issues/18333.
|
|
|
|
|
|
|
|
| |
Allowing :controller and :action values to be specified via the path
in config/routes.rb has been an underlying cause of a number of issues
in Rails that have resulted in security releases. In light of this it's
better that controllers and actions are explicitly whitelisted rather
than trying to blacklist or sanitize 'bad' values.
|
| |
|
|
|
|
|
|
|
| |
We're not guaranteed to have a `RequestEncoder` to assign on `get` requests
because we aren't extracting the parser from the response content type.
Until now.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
When testing:
```ruby
post articles_path, params: { article: { title: 'Ahoy!' } }, as: :json
```
It's common to want to make assertions on the response body. Perhaps the
server responded with JSON, so you write `JSON.parse(response.body)`.
But that gets tedious real quick.
Instead add `parsed_body` which will automatically parse the reponse
body as what the last request was encoded `as`.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Turns
```
post articles_path(format: :json), params: { article: { name: 'Ahoy!' } }.to_json,
headers: { 'Content-Type' => 'application/json' }
```
into
```
post articles_path, params: { article: { name: 'Ahoy!' } }, as: :json
```
|
|
|
|
|
| |
These warings have been appeared from
ea9bc06c9a47b839d5e2db94ba6bf7e29c8f0ae9.
|
|
|
|
| |
parse RSS/ATOM responses as XML, not HTML
|
| |
|
|
|
|
|
| |
- webservers do not do it
- it makes redirect urls ugly when request.host is used for redirection
|
|
|
|
|
|
|
|
|
| |
This will silence deprecation warnings.
Most of the test can be changed from `render :text` to render `:plain`
or `render :body` right away. However, there are some tests that needed
to be fixed by hand as they actually assert the default Content-Type
returned from `render :body`.
|
| |
|
|
|
|
|
|
| |
ActionDispatch::IntegrationTest HTTP request methods will accept only
certain kwargs in the future. This test caused a deprecation warning
when running ActionPack tests. Added `params` and `headers` to fix.
|
|
|
|
|
| |
Regexp is broken for both content types including charsets and for
integration tests, where the content_type is a Mime::Type and not String
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This fixes the reasons 4cf3b8a, 303567e, and fa63448 needed to be
reverted in 7142059. The revert has been reverted and this fixes
the issues caused previously.
If we call `super` first we will end up nuking the session settings in the
application tests that do `setup do` - so any session login or cookie
settings will not be persisted thoughout the test sessions.
Calling `super` last prevents `@integration_session` from getting nuked
and set to nil if it's already set.
Test added to prevent regression of this behavior in the future.
|
|
|
|
|
|
|
| |
Fixes regression in #18423. Merge default headers for new responses,
but don't merge when creating a response from the last session request.
hat tip @senny :heart:
|
|\
| |
| | |
Migrating xhr methods to keyword arguments syntax
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
in `ActionController::TestCase` and
`ActionDispatch::Integration`
Old syntax:
`xhr :get, :create, params: { id: 1 }`
New syntax example:
`get :create, params: { id: 1 }, xhr: true`
|
|/
|
|
| |
ref: https://github.com/rails/rails/pull/18763#issuecomment-72349769
|
| |
|
| |
|
|
|
|
|
|
|
|
| |
Non-kwargs requests are deprecated now.
Guides are updated as well.
`post url, nil, nil, { a: 'b' }` doesn't make sense.
`post url, params: { y: x }, session: { a: 'b' }` would be an explicit way to do the same
|
| |
|
| |
|
|
|
|
| |
test response.
|
| |
|
|
|
|
|
|
|
|
|
| |
This reverts commit f93df52845766216f0fe36a4586f8abad505cac4, reversing
changes made to a455e3f4e9dbfb9630d47878e1239bc424fb7d13.
Conflicts:
actionpack/lib/action_controller/test_case.rb
actionview/lib/action_view/test_case.rb
|
|
|
|
| |
Fixes: https://github.com/rails/rails/issues/16814
|
|
|
|
| |
[related #17233]
|
|
|
|
| |
This is to match the changes in Rails Dom Testing rails/rails-dom-testing#20.
|