| Commit message (Collapse) | Author | Age | Files | Lines |
... | |
|
|
|
|
|
|
|
|
|
| |
I'm making this change so that I can construct response objects that
*don't* have the default headers applied. For example, I would like to
construct a response object from the return value of a controller.
If you need to construct a response object with the default headers,
then please use the alternate constructor:
`ActionDispatch::Response.create`
|
|
|
|
|
| |
We should be asking the mime type method for the mime objects rather
than via const lookup
|
| |
|
|
|
|
|
|
| |
`extra_keys` is a confusing variable name because it's not clear what is
"extra". This renames it to `query_string_keys` so it's clear that the
"extra" is just the query string.
|
|
|
|
|
|
|
| |
Actions are processed through `dispatch`, so they should have the
request set on them before any user land code can be executed. Lets
stop setting _env on the controller, and give access to it through the
`env` method.
|
|
|
|
|
| |
- webservers do not do it
- it makes redirect urls ugly when request.host is used for redirection
|
|
|
|
|
| |
eventually we will make the cookie jar derive these values from the
request object rather than save a reference to the values
|
|
|
|
|
|
| |
Accessing a request object has nice advantages over accessing a hash.
If you use a missing method name, you'll get an exception rather than a
`nil` (is one nice feature)
|
| |
|
| |
|
| |
|
|
|
|
| |
Rack [already implements `redirect?` on the response object](https://github.com/rack/rack/blob/1569a985e17d9caaf94d0e97d95ef642c4ab14ba/lib/rack/response.rb#L141) so we don't need to implement our own.
|
|
|
|
|
|
|
|
| |
We shouldn't depend on specific methods imlemented in the TestResponse
subclass because the response could actually be a real response object.
In the future, we should either push the aliased predicate methods in
TestResponse up to the real response object, or remove them
|
|
|
|
| |
this prevents mutations from being available globally
|
| |
|
| |
|
| |
|
|
|
|
|
| |
We should leverage the request / response objects that the superclass
has already allocated for us.
|
| |
|
|
|
|
|
| |
we should be pushing the cookies in via headers rather than maintaining
some object and "recycling" it.
|
| |
|
|\
| |
| | |
Deprecate `assert_template` and `assigns()`.
|
| | |
|
|/
|
|
|
|
| |
It's better to use Ruby methods when possible over methods defined by
Active Support because then it does not need to rely on any
dependencies.
|
|
|
|
| |
Based on #19976 and #18305.
|
|
|
|
|
|
| |
`*args` is not required here and should be avoided when not necessary
because `*args` are slower than `args` and create unnecessary array
allocations.
|
|
|
|
|
|
| |
This method is being used in `#xml_http_request`, but was not properly
required. This causes `NoMethodError` on projects that are doing
integration test.
|
|
|
|
|
| |
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.
|
|
|
|
| |
This reverts commit 714205988315d2f98aa3e749747c44470e18676b.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The bug caused a segfault and you can find more info about it at:
https://bugs.ruby-lang.org/issues/10685.
We did a couple of work arounds, but 2.2.1 rolled out and those aren't
needed anymore.
Here are the reverted commits:
- Revert "Work around for upstream Ruby bug #10685",
commit 707a433870e9e06af688f85a4aedc64a90791a64.
- Revert "Fix segmentation fault in ActionPack tests",
commit 22e0a22d5f98e162290d9820891d8191e720ad3b.
I'm also bumping the Ruby version check to 2.2.1 to prevent future
segfaults.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
In f6e293ec54f02f83cdb37502bea117f66f87bcae we avoided a segfault in the
tests, however I think we should try to avoid the crash, as it may
happen in user code as well.
Here is what I distiled the bug down to:
```ruby
# Rails case - works on 2.0, 2.1; crashes on 2.2
require 'action_dispatch'
ActionDispatch::Response.new(200, "Content-Type" => "text/xml")
# General case - works on 2.0, 2.1; crashes on 2.2
def foo(optional = {}, default_argument: nil)
end
foo('quux' => 'bar')
```
|
|
|
|
|
|
|
|
|
|
|
|
| |
Haven't diagnosed yet. No similarly failing tests in Rails to work from.
cc @tenderlove, @eileencodes
Revert "there is always an integration session, so remove the check"
Revert "lazily create the integration session"
Revert "use before_setup to set up test instance variables"
This reverts commits 4cf3b8ac47f109fa83a6f66eb97d6cb0eace0d05, 303567e554de26822f3107be55c471d6477a745f, and fa63448420d3385dbd043aca22dba973b45b8bb2.
|
|
|
|
|
|
|
| |
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:
|
|\
| |
| | |
Allow `method: "all"` as a valid routing test option
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
This allows the test to mirror the production code, since `via: :all` is
a valid option. The behavior in 4.1 did not actually test that it
matched all verbs, but instead defaulted to testing for "GET". This
implementation aims to better handle the intention of passing "all".
What will actually be asserted doesn't quite match up with the generated
route, since it appears to just not create a constraint on the method.
However, I don't think that we can easily test the lack of that
constraint. Testing each of the main 4 HTTP verbs seems to be a
reasonably close approximation, which should be sufficient for our
needs.
Fixes #18511.
|
| | |
|
| | |
|
| | |
|
| | |
|
| |
| |
| |
| |
| | |
there's really no benefit here. It's the same number of lines without
the meta programming and is faster
|
| | |
|
| |
| |
| |
| | |
now we don't have to call reset! everywhere
|
| | |
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
We shouldn't cache if it's not absolutely necessary. Removes
route caching and instead skips using the `url_helpers` is the
integration test session doesn't require it. Benchmark ips on
integration and controller index method tests below.
Without any caching or changes to `#url_helpers`:
```
Calculating -------------------------------------
INDEX: Integration Test
71.000 i/100ms
INDEX: Functional Test
99.000 i/100ms
-------------------------------------------------
INDEX: Integration Test
728.878 (± 8.0%) i/s - 3.692k
INDEX: Functional Test
1.015k (± 6.7%) i/s - 5.148k
Comparison:
INDEX: Functional Test: 1015.4 i/s
INDEX: Integration Test: 728.9 i/s - 1.39x slower
```
With caching on `#url_helpers`:
```
Calculating -------------------------------------
INDEX: Integration Test
74.000 i/100ms
INDEX: Functional Test
99.000 i/100ms
-------------------------------------------------
INDEX: Integration Test
752.377 (± 6.9%) i/s - 3.774k
INDEX: Functional Test
1.021k (± 6.7%) i/s - 5.148k
Comparison:
INDEX: Functional Test: 1021.1 i/s
INDEX: Integration Test: 752.4 i/s - 1.36x slower
```
Afer removing the caching and bypassing the `url_helpers` when not
necessary in the session:
```
Calculating -------------------------------------
INDEX: Integration Test
87.000 i/100ms
INDEX: Functional Test
97.000 i/100ms
-------------------------------------------------
INDEX: Integration Test
828.433 (± 6.4%) i/s - 4.176k
INDEX: Functional Test
926.763 (± 7.2%) i/s - 4.656k
Comparison:
INDEX: Functional Test: 926.8 i/s
INDEX: Integration Test: 828.4 i/s - 1.12x slower
```
|
|\ \
| | |
| | | |
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
|
| | |
|