aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack
Commit message (Collapse)AuthorAgeFilesLines
...
* | | Add #25546 and #25817 to changelog [ci skip]Philip Nguyen2016-09-231-0/+8
|/ /
* | Merge pull request #26589 from kirs/ad-test-request-methodArthur Nogueira Neves2016-09-222-1/+8
|\ \ | | | | | | Fix memoization bug on ActionDispatch::TestRequest#request_method=
| * | Fix memoization bug on ActionDispatch::TestRequest#request_method=Kir Shatrov2016-09-222-1/+8
| |/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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 error message when include assertions failMichael Grosser2016-09-167-21/+21
| | | | | | | | | | | | 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
* | Merge pull request #26498 from FriedSock/correct-render-text-deprecation-messageRafael França2016-09-141-1/+1
|\ \ | | | | | | Correct `render text:` deprecation message
| * | Correct `render text:` deprecation messageJack Bracewell2016-09-141-1/+1
| | | | | | | | | The default Content-Type is `text/html`, not `text/plain`.
* | | Merge pull request #26477 from kirs/action_dispatch-assert_responseRafael França2016-09-142-2/+29
|\ \ \ | |/ / |/| | Improve assert_response helper
| * | Improve assert_response helperKir Shatrov2016-09-142-2/+29
| |/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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'"]} ```
* | Fix broken comments indentation caused by rubocop auto-correct [ci skip]Ryuta Kamizono2016-09-1410-49/+49
| | | | | | | | | | | | 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.
* | Do not mutate AC::TestRequest::DEFAULT_OPTIONSKir Shatrov2016-09-102-1/+6
|/
* Merge pull request #26418 from y-yagi/fixes_26415Richard Schneeman2016-09-072-1/+8
|\ | | | | call `.to_h` to avoid using deprecated method
| * call `.to_h` to avoid using deprecated methodyuuji.yaginuma2016-09-072-1/+8
| | | | | | | | | | | | | | | | | | | | | | `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
* | Merge pull request #26016 from nateberkopec/patch-1Vipul A M2016-09-071-2/+3
|\ \ | |/ |/| Clarify expires_now documentation
| * Clarify expires_now documentationNate Berkopec2016-09-061-2/+3
| | | | | | | | [ci skip]
* | Merge pull request #26377 from y-yagi/rename_test_method_to_avoid_overridingEileen M. Uchitelle2016-09-041-1/+1
|\ \ | | | | | | rename test method to avoid overriding
| * | rename test method to avoid overridingyuuji.yaginuma2016-09-031-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | 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 ```
* | | Merge pull request #26384 from ↵Eileen M. Uchitelle2016-09-043-1/+43
|\ \ \ | | | | | | | | | | | | | | | | y-yagi/make_fixture_file_upload_in_integration_test make `fixture_file_upload` work in integration tests
| * | | make `fixture_file_upload` work in integration testsyuuji.yaginuma2016-09-043-1/+43
| |/ / | | | | | | | | | | | | | | | | | | | | | | | | 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`.
* / / Fix broken heredoc indentation caused by rubocop auto-correctRyuta Kamizono2016-09-033-8/+8
|/ / | | | | | | | | | | All indentation was normalized by rubocop auto-correct at 80e66cc4d90bf8c15d1a5f6e3152e90147f00772. But heredocs was still kept absolute position. This commit aligns heredocs indentation for consistency.
* | RuboCop is 100% green :tada:Xavier Noria2016-09-022-11/+12
| |
* | fixes remaining RuboCop issues [Vipul A M, Xavier Noria]Xavier Noria2016-09-0110-15/+15
| |
* | Start passing cipher from EncryptedCookieJar since we use it to determine ↵Vipul A M2016-09-012-20/+17
| | | | | | | | key length
* | Follow up of #25602Vipul A M2016-09-012-15/+31
| | | | | | | | | | | | | | | | | | 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.
* | Add changelog entry for #26328.Kasper Timm Hansen2016-08-311-0/+7
| | | | | | | | | | I consider the missing deprecation warning a bug fix from the point of view of the 5.0.x series and forward.
* | Move to_param undef closer to the deprecations.Kasper Timm Hansen2016-08-311-2/+4
| | | | | | | | | | | | | | 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.
* | Merge pull request #26328 from kirs/strong-params-to-paramKasper Timm Hansen2016-08-312-0/+9
|\ \ | | | | | | Do not allow to_param on AC::Parameters
| * | Do not allow to_param on AC::ParametersKir Shatrov2016-08-312-0/+9
| | |
* | | Override `respond_to_missing?` instead of `respond_to?` when possibleSean Griffin2016-08-312-2/+2
|/ / | | | | | | | | | | | | | | | | | | 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.
* | Merge pull request #26317 from maclover7/jm-fix-26298Aaron Patterson2016-08-293-8/+30
|\ \ | | | | | | Allow `send_file` to declare a charset
| * | Remove default argument, and extract internal convenience methodJon Moss2016-08-291-6/+12
| | |
| * | Add regression testsJon Moss2016-08-291-0/+14
| | |
| * | Allow `send_file` to declare a charsetJon Moss2016-08-292-4/+6
| | | | | | | | | | | | | | | | | | Removed my patch in favor of @tenderlove's less invasive approach. [Aaron Patterson & Jon Moss]
* | | Fix nested multiple rootsRyo Hashimoto2016-08-293-2/+61
|/ / | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* | Remove unneeded FIXME noteRafael Mendonça França2016-08-291-2/+0
| | | | | | | | | | This is the intended behavior. You should not do more than one request in a controller test.
* | Missing key should throw KeyErroreileencodes2016-08-262-1/+7
| | | | | | | | | | | | It should not throw a NameError, but should throw a KeyError. Fixes #26278
* | Fix typo in the hook nameRafael Mendonça França2016-08-251-1/+1
| |
* | Add load hooks to all tests classesRafael Mendonça França2016-08-251-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* | Merge pull request #26235 from ↵Sean Griffin2016-08-242-1/+23
|\ \ | | | | | | | | | | | | samphippen/allow-early-setting-of-integration-session Allow the `integration_sesion` to be set early on ActionDispatch::Integration::Runner.
| * | Move setting of integration session to constructor.Sam Phippen2016-08-211-1/+5
| | | | | | | | | | | | This allows us to not `||=` in `before_setup`.
| * | Allow the `integration_sesion` to be set early on ↵Sam Phippen2016-08-202-1/+19
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* | | yl - remove extra …yunlei2016-08-231-1/+1
| | |
* | | Include the content of the flash in the auto-generated etag (#26250)David Heinemeier Hansson2016-08-225-0/+59
| | | | | | | | | Include the content of the flash in the auto-generated etag
* | | Return 307 status instead of 301 when rerouting POST requests to SSLChirag Singhal2016-08-223-1/+43
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* | | Fix `ActionDispatch::Http::URL` docs [ci skip]Ryoji Yoshioka2016-08-221-65/+21
|/ / | | | | | | Use ActionDispatch::Request instead of Request because ActionDispatch::Request no longer inherits from Rack::Request.
* | Copy edits in the documentation [ci skip]Rafael Mendonça França2016-08-192-4/+6
| |
* | Set the request type if as: is specifiedEverest Munro-Zeisberger2016-08-183-1/+22
| | | | | | | | Documentation & testing
* | Change method visibility to be privateRafael Mendonça França2016-08-171-57/+57
| | | | | | | | | | Those methods are only using inside this module and by a private method so they all should be private.
* | Push :defaults extraction down one levelRafael Mendonça França2016-08-172-60/+78
| | | | | | | | | | | | | | | | | | | | | | | | | | 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`.
* | Merge pull request #25862 from ↵प्रथमेश Sonpatki2016-08-171-6/+12
|\ \ | | | | | | | | | | | | prathamesh-sonpatki/start-documenting-ac-testcase-again Start documenting ActionController::TestCase again
| * | Start documenting ActionController::TestCase againPrathamesh Sonpatki2016-08-171-6/+12
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | - 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]