aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/lib/action_dispatch/testing/integration.rb
Commit message (Collapse)AuthorAgeFilesLines
* Push `before_sending` to super classeileencodes2015-12-061-0/+1
| | | | | | | | | | | | We want to get rid of the `Live::Response` so we are consolidating methods from `Live::Response` and `Response` by merging them together. This adds an `#empty` method to the request so we don't need to hard-code the empty array each time we call an empty `ActionDispatch::Request`. The work here is a continuation on combining controller and integration test code bases into one.
* specify deprecated waring, follow the standard conventionsGaurav Sharma2015-10-281-5/+5
| | | | `skip_filter`, `skip_action_callback` may both are deprecated in Rails 5.1 so waring msg should be specific.
* Use `Mime[:foo]` instead of `Mime::Type[:FOO]` for back compatJeremy Daer2015-10-061-1/+1
| | | | | | | | | | | | | | | | | Rails 4.x and earlier didn't support `Mime::Type[:FOO]`, so libraries that support multiple Rails versions would've had to feature-detect whether to use `Mime::Type[:FOO]` or `Mime::FOO`. `Mime[:foo]` has been around for ages to look up registered MIME types by symbol / extension, though, so libraries and plugins can safely switch to that without breaking backward- or forward-compatibility. Note: `Mime::ALL` isn't a real MIME type and isn't registered for lookup by type or extension, so it's not available as `Mime[:all]`. We use it internally as a wildcard for `respond_to` negotiation. If you use this internal constant, continue to reference it with `Mime::ALL`. Ref. efc6dd550ee49e7e443f9d72785caa0f240def53
* stop calling deprecated methodsAaron Patterson2015-09-211-1/+1
| | | | | We should be asking the mime type method for the mime objects rather than via const lookup
* pass a request object to the headers objectAaron Patterson2015-08-211-2/+2
|
* stop using @_env in the controller instanceAaron Patterson2015-08-071-1/+1
| | | | | | | 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.
* do not add common ports to HTTP_HOSTMichael Grosser2015-08-061-1/+5
| | | | | - webservers do not do it - it makes redirect urls ugly when request.host is used for redirection
* Add `:nodoc:` for internal testing methods [ci skip]Robin Dupret2015-07-281-1/+1
|
* Merge pull request #20138 from tgxworld/deprecated_assert_templateRafael Mendonça França2015-06-011-1/+0
|\ | | | | Deprecate `assert_template` and `assigns()`.
| * Remove `assigns` and `assert_template`.Guo Xiang Tan2015-05-301-1/+0
| |
* | Use `any?` rather than `present?` to check argseileencodes2015-05-311-1/+1
|/ | | | | | 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.
* [ci skip] remove `assigns` from the integration test example in API docsRoque Pinel2015-05-171-2/+2
| | | | Based on #19976 and #18305.
* Use `args` instead of `*args` in `kwargs_request?` methodeileencodes2015-05-021-3/+3
| | | | | | `*args` is not required here and should be avoided when not necessary because `*args` are slower than `args` and create unnecessary array allocations.
* Add missing require for String#strip_heredocPrem Sichanugrist2015-04-171-0/+1
| | | | | | This method is being used in `#xml_http_request`, but was not properly required. This causes `NoMethodError` on projects that are doing integration test.
* Call super last in before_setupeileencodes2015-03-091-1/+1
| | | | | | | | | | | | | | | 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.
* Revert "Revert integration test refactoring that caused app test regressions"eileencodes2015-03-091-14/+10
| | | | This reverts commit 714205988315d2f98aa3e749747c44470e18676b.
* update integration test example as is not output deprecation warning [ci skip]yuuji.yaginuma2015-03-071-7/+8
|
* Revert integration test refactoring that caused app test regressionsJeremy Kemper2015-02-261-10/+14
| | | | | | | | | | | | 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.
* Fix default headers in test responsesJeremy Kemper2015-02-251-1/+1
| | | | | | | 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:
* Add missing commaArthur Neves2015-02-131-1/+1
|
* Correct module name in deprecation message.Guo Xiang Tan2015-02-131-1/+1
|
* Improve deprecation message.Guo Xiang Tan2015-02-131-1/+3
|
* Do not recommend `xhr` since it is going to be deprecated.Guo Xiang Tan2015-02-131-3/+0
|
* remove meta programmingAaron Patterson2015-02-121-3/+3
| | | | | there's really no benefit here. It's the same number of lines without the meta programming and is faster
* there is always an integration session, so remove the checkAaron Patterson2015-02-121-1/+0
|
* lazily create the integration sessionAaron Patterson2015-02-121-7/+5
| | | | now we don't have to call reset! everywhere
* use before_setup to set up test instance variablesAaron Patterson2015-02-121-7/+6
|
* Skip url_helpers instead of caching, speed up integration testseileencodes2015-02-121-10/+15
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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 syntaxKir Shatrov2015-02-011-8/+16
| | | | | | | | | | | | in `ActionController::TestCase` and `ActionDispatch::Integration` Old syntax: `xhr :get, :create, params: { id: 1 }` New syntax example: `get :create, params: { id: 1 }, xhr: true`
* Consistent usage of spaces in hashes across our codebaseRafael Mendonça França2015-01-291-2/+2
|
* Use fixed fonts only in the name of the parameterRafael Mendonça França2015-01-291-3/+3
|
* Switch to kwargs in ActionController::TestCase and ActionDispatch::IntegrationKir Shatrov2015-01-291-37/+104
| | | | | | | | Non-kwargs requests are deprecated now. Guides are updated as well. `post url, nil, nil, { a: 'b' }` doesn't make sense. `post url, params: { y: x }, session: { a: 'b' }` would be an explicit way to do the same
* Deprecate *_via_redirect integration test methodsAditya Kapoor2015-01-281-0/+5
|
* Move longer form example from integration guide to api reference, below anZachary Scott2014-12-291-0/+78
| | | | | | | | existing example. [ci skip] My reasoning is that this is probably too much information for the complete Rails testing guide, as we're trying to cover testing all aspects of the framework.
* Make sure assert_select can assert body tagRafael Mendonça França2014-11-181-1/+1
| | | | | | | | | This reverts commit f93df52845766216f0fe36a4586f8abad505cac4, reversing changes made to a455e3f4e9dbfb9630d47878e1239bc424fb7d13. Conflicts: actionpack/lib/action_controller/test_case.rb actionview/lib/action_view/test_case.rb
* Fix for assigns(:..) resetting template assertionsCalvin Correli2014-11-171-3/+7
| | | | When calling assigns(:...) or cookies(:...), template assertions would be reset, which they obviously shouldn't be.
* Remove session to allow `with_routing` to be called twice.Guo Xiang Tan2014-11-051-0/+4
| | | | Fixes: https://github.com/rails/rails/issues/16814
* Parse HTML as document fragment.Kasper Timm Hansen2014-09-291-1/+1
| | | | This is to match the changes in Rails Dom Testing rails/rails-dom-testing#20.
* Merge branch 'master' into loofahRafael Mendonça França2014-08-121-1/+3
|\ | | | | | | | | | | | | Conflicts: actionpack/CHANGELOG.md actionpack/test/controller/integration_test.rb actionview/CHANGELOG.md
| * Revert "Merge pull request #15305 from tgxworld/remove_unnecessary_require"Santiago Pastorino2014-07-301-0/+1
| | | | | | | | | | | | | | This reverts commit f632f79b8dcd144408c66a544984b2ba9cf52f87, reversing changes made to 98c7fe87690ca4de6c46e8f69806e82e3f8af42d. Closes #16343
| * Fix AC::TemplateAssertions instance variables not resetting.Guo Xiang Tan2014-07-211-0/+1
| | | | | | | | Fixes https://github.com/rails/rails/issues/16119.
| * routed applications will respond to these methodsAaron Patterson2014-07-151-1/+1
| |
* | Merge pull request #11218 from kaspth/loofah-integrationRafael Mendonça França2014-07-101-0/+4
|\ \ | |/ |/| | | | | | | | | | | Loofah-integration Conflicts: actionpack/CHANGELOG.md actionview/CHANGELOG.md
| * Add document_root_element to ActionDispatch::IntegrationTest so ↵Timm2014-06-161-0/+4
| | | | | | | | assert_select can be called without specifying a root.
| * Moved ActionView::Assertions dependency from Action Pack's lib to ↵Timm2014-06-161-2/+1
| | | | | | | | abstract_unit.rb.
| * Moved Dom and Selector assertions from ActionDispatch to ActionView.Timm2014-06-161-1/+2
| |
* | remove the mounted_helpers respond_to checkAaron Patterson2014-07-071-1/+1
| | | | | | | | It always responds to mounted_helpers now
* | always test against a routed rack app so there are always url_helpersAaron Patterson2014-07-071-1/+1
| |
* | Remove unused parameter.Guo Xiang Tan2014-06-151-1/+1
|/
* Merge pull request #15061 from tgxworld/remove_unnecessary_includeMatthew Draper2014-05-291-6/+0
|\ | | | | Remove unnecessary include for integration tests.