| Commit message (Collapse) | Author | Age | Files | Lines |
... | |
|/ / |
|
|\ \
| | |
| | | |
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)`
|
| |
| |
| |
| |
| |
| | |
assert [1, 3].includes?(2) fails with unhelpful "Asserting failed" message
assert_includes [1, 3], 2 fails with "Expected [1, 3] to include 2" which makes it easier to debug and more obvious what went wrong
|
|\ \
| | |
| | | |
Correct `render text:` deprecation message
|
| | |
| | |
| | | |
The default Content-Type is `text/html`, not `text/plain`.
|
|\ \ \
| |/ /
|/| | |
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'"]}
```
|
| |
| |
| |
| |
| |
| | |
All indentation was normalized by rubocop auto-correct at 80e66cc4d90bf8c15d1a5f6e3152e90147f00772.
But comments was still kept absolute position. This commit aligns
comments with method definitions for consistency.
|
|/ |
|
|\
| |
| | |
call `.to_h` to avoid using deprecated method
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
`ActionController::Parameters#merge` call `HashWithIndifferentAccess#merge`.
In addition, it calls `HashWithIndifferentAccess#update` from
`HashWithIndifferentAccess#merge`, where it is called the `#to_hash` of argument.
But `ActionController::Parameters#to_hash` is deprecated, warning message is
displayed.
To avoid this, modify to convert object to `Hash`.
Fixes #26415
|
|\ \
| |/
|/| |
Clarify expires_now documentation
|
| |
| |
| |
| | |
[ci skip]
|
|\ \
| | |
| | | |
rename test method to avoid overriding
|
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
This removes the following warning.
```
./test/dispatch/routing_test.rb:3696: warning: method redefined; discarding old test_namespaced_roots
./test/dispatch/routing_test.rb:1632: warning: previous definition of test_namespaced_roots was here
```
|
|\ \ \
| | | |
| | | |
| | | |
| | | | |
y-yagi/make_fixture_file_upload_in_integration_test
make `fixture_file_upload` work in integration tests
|
| |/ /
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
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`.
|
|/ /
| |
| |
| |
| |
| | |
All indentation was normalized by rubocop auto-correct at 80e66cc4d90bf8c15d1a5f6e3152e90147f00772.
But heredocs was still kept absolute position. This commit aligns
heredocs indentation for consistency.
|
| | |
|
| | |
|
| |
| |
| |
| | |
key length
|
| |
| |
| |
| |
| |
| |
| |
| |
| | |
Since keys are truncated, ruby 2.4 doesn't accept keys greater than their lenghts.
keys of same value but different lenght and greater than key size of cipher, produce the same results
as reproduced at https://gist.github.com/rhenium/b81355fe816dcfae459cc5eadfc4f6f9
Since our default cipher is 'aes-256-cbc', key length for which is 32 bytes, limit the length of key being passed to Encryptor to 32 bytes.
This continues to support backwards compat with any existing signed data, already encrupted and signed with 32+ byte keys.
Also fixes the passing of this value in multiple tests.
|
| |
| |
| |
| |
| | |
I consider the missing deprecation warning a bug fix from
the point of view of the 5.0.x series and forward.
|
| |
| |
| |
| |
| |
| |
| | |
Makes it clearer why we're doing this
Add a comment to elaborate on what the undef means and move it closer
to the deprecations so it's less likely for whoever pulls the
deprecations that it should go too.
|
|\ \
| | |
| | | |
Do not allow to_param on AC::Parameters
|
| | | |
|
|/ /
| |
| |
| |
| |
| |
| |
| |
| |
| | |
This was almost every case where we are overriding `respond_to?` in a
way that mirrors a parallel implementation of `method_missing`. There is
one remaining case in Active Model that should probably do the same
thing, but had a sufficiently strange implementation that I want to
investigate it separately.
Fixes #26333.
|
|\ \
| | |
| | | |
Allow `send_file` to declare a charset
|
| | | |
|
| | | |
|
| | |
| | |
| | |
| | |
| | |
| | | |
Removed my patch in favor of @tenderlove's less invasive approach.
[Aaron Patterson & Jon Moss]
|
|/ /
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
The PR #20940 enabled the use of multiple roots with different constraints
at the top level but unfortunately didn't work when those roots were inside
a namespace and also broke the use of root inside a namespace after a top
level root was defined because the check for the existence of the named route
used the global :root name and not the namespaced name.
This is fixed by using the name_for_action method to expand the :root name to
the full namespaced name. We can pass nil for the second argument as we're not
dealing with resource definitions so don't need to handle the cases for edit
and new routes.
Fixes #26148.
|
| |
| |
| |
| |
| | |
This is the intended behavior. You should not do more than one request
in a controller test.
|
| |
| |
| |
| |
| |
| | |
It should not throw a NameError, but should throw a KeyError.
Fixes #26278
|
| | |
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
Usually users extends tests classes doing something like:
ActionView::TestCase.include MyCustomTestHelpers
This is bad because it will load the ActionView::TestCase right aways
and this will load ActionController::Base making its on_load hooks to
execute early than it should.
One way to fix this is using the on_load hooks of the components like:
ActiveSupport.on_load(:action_view) do
ActionView::TestCase.include MyCustomTestHelpers
end
The problem with this approach is that the test extension will be only
load when ActionView::Base is loaded and this may happen too late in the
test.
To fix this we are adding hooks to people extend the test classes that
will be loaded exactly when the test classes are needed.
|
|\ \
| | |
| | |
| | |
| | | |
samphippen/allow-early-setting-of-integration-session
Allow the `integration_sesion` to be set early on ActionDispatch::Integration::Runner.
|
| | |
| | |
| | |
| | | |
This allows us to not `||=` in `before_setup`.
|
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
ActionDispatch::Integration::Runner.
In commit fa63448420d3385dbd043aca22dba973b45b8bb2, @tenderlove changed
the behaviour of the way `integration_session` is set up in this object.
It used to be the case that the first time it was accessed, it was
memoized with nil, however, this means that if it had already been set
it was not replaced. After that commit, it is now always set to `nil` in
the execution of `before_setup`.
In RSpec, users are able to invoke `host!` in `before(:all)` blocks,
which execute well before `before_setup` is ever invoked (which happens
in what is equivalent to a `before(:each)` block, for each test. `host!`
causes the integration session to be set up to correctly change the
host, but after fa63448420d3385dbd043aca22dba973b45b8bb2 the
`integration_session` gets overwritten, meaning that users lose their
`host!` configuration (see https://github.com/rspec/rspec-rails/issues/1662).
This commit changes the behaviour back to memoizing with `nil`, as
opposed to directly overwriting with `nil`. This causes the correct
behaviour to occur in RSpec, and unless I'm mistaken will also ensure
that users who want to modify their integration sessions early in rails
will also be able to do so.
|
| | | |
|
| | |
| | |
| | | |
Include the content of the flash in the auto-generated etag
|
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
When `config.force_ssl` is set to `true`, any POST/PUT/DELETE requests coming in to non-secure url are being redirected with a 301 status.
However, when that happens, the request is converted to a GET request and ends up hitting a different action on the controller.
Since we can not do non-GET redirects, we can instead redirect with a 307 status code instead to indicate to the caller that a fresh request should be tried preserving the original request method.
`rack-ssl` gem which was used to achieve this before we had this middleware directly baked into Rails also used to do the same, ref: https://github.com/josh/rack-ssl/blob/master/lib/rack/ssl.rb#L54
This would be specially important for any apps switching from older version of Rails or apps which expose an API through Rails.
|
|/ /
| |
| |
| | |
Use ActionDispatch::Request instead of Request because ActionDispatch::Request no longer inherits from Rack::Request.
|
| | |
|
| |
| |
| |
| | |
Documentation & testing
|
| |
| |
| |
| |
| | |
Those methods are only using inside this module and by a private method
so they all should be private.
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
Since e852daa6976cc6b6b28ad0c80a188c06e226df3c only the verb methods
where extracting the defaults options. It was merged a fix for the
`root` method in 31fbbb7faccba25b2e3b5e10b8fca1468579d629 but `match`
was still broken since `:defaults` where not extracted.
This was causing routes defined using `match` and having the `:defaults`
keys to not be recognized.
To fix this it was extracted a new private method with the actual
content of `match` and the `:defaults` extracting was moved to `match`.
|
|\ \
| | |
| | |
| | |
| | | |
prathamesh-sonpatki/start-documenting-ac-testcase-again
Start documenting ActionController::TestCase again
|
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
- Rails 5 changed interface for passing arguments to request methods to
keyword args for AC::TestCase but also hid the documentation.
- But existing AC::TestCase tests need the new documentation about
keyword args. So resurrected documentation and added a note about not
using this for new tests.
- The guides and other documentation is already updated to use
`ActionDispatch::IntegrationTest`.
[Matthew Draper, Prathamesh Sonpatki]
|