| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
| |
ActionDispatch::TestProcess::FixtureFile
|
|
|
|
|
| |
In cases where the MatchData object is not used, this provides a speed-up:
https://github.com/JuanitoFatas/fast-ruby/#stringmatch-vs-stringmatch-vs-stringstart_withstringend_with-code-start-code-end
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
When a `get` method called with `as: :json` and `params: nil` or
`params: false` (explicitly or implicitly)
`RequestEncoder#encode_params` converts it into a `null` or `false`
value which includes a unexpected `null=` or `false` query string into
request URL. From now on `RequestEncoder#encode_params` checks whether
`params` is nil or not otherwise returns.
Move down `nil` conversion guard
Update CHANGELOG.md
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* Allow get arguments for follow_redirect
Now all arguments passed to `follow_redirect!` are passed to the
underlying `get` method. This for example allows to set custom headers
for the redirection request to the server.
This is especially useful for setting headers that may, outside of the
testing environment, be set automatically on every request, i.e. by a
web application firewall.
* Allow get arguments for follow_redirect
[Remo Fritzsche + Rafael Mendonça França]
|
|\
| |
| |
| |
| | |
Updates documentation on ActionDispatch::Integration::Session#process
[ci skip]
|
| |
| |
| |
| |
| |
| | |
Adds missing information on 2 parameters: +xhr+ and +as+
[ci skip]
|
| |
| |
| |
| |
| | |
This basically reverts e9fca7668b9eba82bcc832cb0061459703368397, d08da958b9ae17d4bbe4c9d7db497ece2450db5f,
d1fe1dcf8ab1c0210a37c2a78c1ee52cf199a66d, and 68eaf7b4d5f2bb56d939f71c5ece2d61cf6680a3
|
| | |
|
| | |
|
| |
| |
| |
| | |
https://github.com/rails/rails/issues/30072
|
|/ |
|
|\ |
|
| |
| |
| |
| |
| | |
This reverts commit 3420a14590c0e6915d8b6c242887f74adb4120f9, reversing
changes made to afb66a5a598ce4ac74ad84b125a5abf046dcf5aa.
|
| |\
| | |
| | |
| | | |
Enforce frozen string in Rubocop
|
| | | |
|
| |\ \
| | |/
| |/|
| | | |
Make ActiveSupport frozen-string-literal friendly.
|
| | |
| | |
| | |
| | | |
Plus a couple of related ActionPack patches.
|
|/ / |
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
- When making a request to a controller that redirects, `follow_redirect!` would not reset the `html_document` ivar, it only resets the `html_document` ivar from the session (not the runner)
- If one was doing something like this;
```ruby
get '/redirect'
assert_select 'you are being redirected'
follow_redirect!
# html_document is memoized and doesn't get reset
```
- To fix the issue we can do the same for any other methods (`get`, `post`...) and define a method in the runner that delegates to the session but clears the html_document_first
- Fixes #29367
|
|/
|
|
| |
`get/post_via_redirect`, `xhr` and his alias `xml_http_request` were respectively removed in 092033d59f7e2b248f6c6ab6c0b67339c5e9f2df and eb52e5d42fbdc9288925a402dcb3c5664d1125b7
|
|
|
|
|
|
|
| |
Follow up of 03d3f036.
Some of `respond_to?` were replaced to `respond_to_missing?` in 03d3f036.
But the visibility is still public. It should be private.
|
|\
| |
| | |
[docs] fix ActionDispatch documentation
|
| | |
|
| | |
|
| |
| |
| |
| |
| | |
Looking on code for this method it's clear that it's just returns `response.status` instead of full `response` object.
It's better to correct docs as probably lots of specs are relying on this behavior.
|
|/
|
| |
Arcticle --> Article
|
|
|
|
|
|
| |
These files are not using `strip_heredoc`.
Closes #27976
|
|
|
|
| |
(I personally prefer writing one string in one line no matter how long it is, though)
|
| |
|
| |
|
|
|
|
|
| |
The rest of the helpers are better placed on Session -- and this is the
only one that cares which class it is defined on.
|
|
|
|
| |
Mention the Accept header and how that figures into the request format.
|
|
|
|
| |
Wrongly added when fixing the request path wrangling.
|
|
|
|
|
|
|
| |
Don't want to add defensive programming to this fairly
simple thing.
Fixes #27060.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Instead of appending a format to the request, it's much better
to just pass a more appropriate accept header. Rails will figure
out the format from that instead.
This allows devs to use `:as` on routes that don't have a format.
Introduce an `IdentityEncoder` to avoid `if request_encoder`,
essentially a better version of the purpose of the `WWWFormEncoder`.
One that makes conceptual sense on GET requests too.
Fixes #27144.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Reset a new session directly after its creation in
`ActionDispatch::IntegrationTest#open_session`. Reset the session to a clean
state before making it available to the client's test code.
Issue #22742 reports unexpected behavior of integration tests that run multiple
sessions. For example an `ActionDispatch::Flash` instance is shared across
multiple sessions, though a client code will rightfully assume that each new
session has its own flash hash.
The following test failed due to this behavior:
class Issue22742Test < ActionDispatch::IntegrationTest
test 'issue #22742' do
integration_session # initialize first session
a = open_session
b = open_session
refute_same(a.integration_session, b.integration_session)
end
end
Instead of creating a new `ActionDispatch::Integration::Session` instance,
the same instance is shared across all newly opened test sessions. This is
due to the way how new test sessions are created in
`ActionDispatch::IntegrationTest#open_session`. The already existing
`ActionDispatch::IntegrationTest` instance is duplicated with `Object#dup`,
This approach was introduced in commit 15c31c7639b. `Object#dup` copies the
instance variables, but not the objects they reference. Therefore this issue
only occurred when the current test instance had been tapped in such a way that
the instance variable `@integration_session` was initialized before creating the
new test session.
Close #22742
[Tawan Sierek + Sina Sadeghian]
|
| |
|
|
|
|
|
|
| |
This reverts commit 5dde413e1d14c42eb87071db20d075a7b962cb01.
Reason: The gem defines it so we don't need to remove
|
| |
|
|
|
|
| |
[ci skip]
|
| |
|
|
|
|
|
|
| |
`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.
|
|
|
|
|
|
|
|
|
|
| |
When passed an already-valid file name, prepending the path is likely to
create problems.
This is particularly relevant for #26384, which adds fixture_path
handling to test classes that previously didn't have it: any existing
caller must have been manually locating the file, and we don't want to
break them.
|
|\
| |
| | |
Fix memoization bug on ActionDispatch::TestRequest#request_method=
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
TestRequest have been overrriding request_method setter since 2009,
but the actual implementation in Request (not TestRequest) has been
changed since that. Now it's also using @request_method instance
variable to keep the state.
The override in TestRequest have not been calling `super`, which caused
a bug that after accessing #requst_method the value was memoized and
then we've never been able to change it anymore:
```
req = ActionDispatch::TestRequest.create
puts "was: #{req.request_method}" # memoized here
req.request_method = "POST"
puts "became: #{req.request_method}"
```
output:
```
was: GET
became: GET
```
Since the whole purpose of overriding the setter in TestRequest is to
upcase it, I'm changing it to `super(method.to_s.upcase)`
|
|/
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
When the check is failed, print the actual response body if it's not too large.
This could improve productivity when writing new tests.
Before:
```
ThemeEditorIntegrationTest#test_whatever
Expected response to be a <200: ok>, but was a <422: Unprocessable Entity>.
Expected: 200
Actual: 422
```
After:
```
ThemeEditorIntegrationTest#test_whatever
Expected response to be a <200: ok>, but was a <422: Unprocessable Entity>.
Expected: 200
Actual: 422
Response body: {"errors":["Invalid settings object for section '1'"]}
```
|
|
|
|
|
|
|
|
|
| |
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`.
|