| Commit message (Collapse) | Author | Age | Files | Lines |
... | |
|
|
|
|
| |
When content type header is blank we were raising an exception because
`empty?` was being called on nil.
|
|
|
|
|
| |
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.
|
| |
|
|
|
|
| |
s/Constrains/Constraints
|
|\
| |
| |
| | |
Fix incorrect output from rails routes when using singular resources …
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
#26606
Rails routes (even rake routes in previous versions) output showed incorrect routes when an application use resource :controller, implying that edit_controller_path match with controller#show.
The order of the output has changed to correct this. View #26606 for more information.
Added a test case, change unit test in rake to expect the new output.
Since the output of resource :controller is changing, the string spected of the railties/test/application/rake_test.rb test_rails_routes_with_controller_environment had to be modified.
|
|/
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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]
|
| |
|
|\
| |
| |
| | |
Don't error on an empty CONTENT_TYPE
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
This commit prevents a possible issue wherein an empty CONTENT_TYPE
header is sent in a request to a Rails application, and then `request.content_mime_type`
would return `nil`. This is because the `has_content_type?` guard method
was not properly checking the validity of a request's content type; it
was only checking to see whether or not the header existed, not whether
it had a value stored inside.
Relatedly, after an internal discussion, it was determined that the
`has_content_type?` method is not meant to be part of the public API,
and is therefore changed to a `:nodoc:` method in this commit.
The test for this behavior is a little bit ugly, for two reasons. One is
that it was difficult to determine where to place the test... I figured
the best place would be with the rest of the ParamsWrapper stuff, since
that's where the original issue was. Also, we have to do some fancy
footwork in calling `dispatch` on the test's controller manually... this
is because `ActionController::TestCase` will throw an error if you try
and pass in a nil content type, which is exactly what we are trying to
test here... Because of that, we have to manually call in to the
controller, and bypass the `post` request helper.
Fixes #26912.
This is a regression in behavior between Rails versions 4.2.x and 5.0.x,
which was introduced via [this commit](https://github.com/rails/rails/commit/a9f28600e901b11a9222e34bfae8642bfb753186).
|
|\ \
| | |
| | | |
Format and send logs to logger.fatal from DebugExceptions
|
| |/
| |
| |
| |
| |
| | |
fatal multiple times. Expose tags_text from TaggedLogging to be used for log formatting
Fixes #26134
|
|\ \
| |/
|/| |
Add missing `+` around a some literals.
|
| |
| |
| |
| |
| |
| | |
Mainly around `nil`
[ci skip]
|
| | |
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
I have been seeing people setting `Logger` instances for `config.logger`
and it blowing up on `rails/web-console` usage.
Now, I doubt many folks are manually setting `ActionView::Base.logger`,
but given that `DebugExceptions` is running in a pretty fragile
environment already, having it crash (and being silent) in those cases
can be pretty tricky to trace down.
I'm proposing we verify whether the `ActionView::Base.logger` supports
silencing before we try to do it, to save us the headache of tracing it
down.
|
| | |
|
| | |
|
| |
| |
| |
| |
| |
| | |
Regexp#match? should be considered to be part of the Ruby core library. We are
emulating it for < 2.4, but not having to require the extension is part of the
illusion of the emulation.
|
|/
|
|
|
|
| |
There were never public API only there by mistake.
[ci skip]
|
|
|
| |
- Followup of fda5afeb
|
|
|
|
|
|
| |
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`.
|
| |
|
| |
|
|
|
|
| |
`ActionDispatch::Routing::Mapper#match`
|
|
|
|
| |
`ActionDispatch::Routing::Mapper#match`
|
|
|
|
| |
`ActionDispatch::Static#initialize`
|
| |
|
| |
|
| |
|
|
|
|
|
|
| |
ActionDispatch::ParamsParser class was removed in favor of
ActionDispatch::Http::Parameters so it is better to move the error
constant to the new class.
|
| |
|
| |
|
| |
|
|
|
|
|
| |
assigns assert the state of a controller instance what should not be
done in an integration test.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
| |
Currently a misleading "missing required keys" error is thrown when a param
fails to match the constraints of a particular route. This commit ensures that
these params are recognised as unmatching rather than missing.
Note: this means that a different error message will be provided between
optimized and non-optimized path helpers, due to the fact that the former does
not check constraints when matching routes.
Fixes #26470.
|
|
|
|
|
|
|
|
|
|
| |
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)`
|
|\ \
| | |
| | | |
Improve assert_response helper
|
| |/
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
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'"]}
```
|