aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/lib/action_dispatch/testing
Commit message (Collapse)AuthorAgeFilesLines
* 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-252-13/+2
| | | | | | | 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:
* Merge pull request #18665 from sgrif/sg-test-route-allSean Griffin2015-02-201-8/+14
|\ | | | | Allow `method: "all"` as a valid routing test option
| * Allow `method: "all"` as a valid routing test optionSean Griffin2015-01-231-8/+14
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* | 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 ```
* | Merge pull request #18771 from kirs/deprecate-xhrRafael Mendonça França2015-02-051-8/+16
|\ \ | | | | | | Migrating xhr methods to keyword arguments syntax
| * | 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`
* | | Use public Module#include, in favor of https://bugs.ruby-lang.org/issues/8846robertomiranda2015-01-311-1/+1
|/ / | | | | | | ref: https://github.com/rails/rails/pull/18763#issuecomment-72349769
* | 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
|/
* Default headers, removed in controller actions, will not be reapplied to the ↵Jonas Baumann2015-01-091-0/+7
| | | | test response.
* Remove deprecated assertion filesRafael Mendonça França2015-01-043-9/+0
|
* 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.
* Pass symbol as an argument instead of a blockErik Michaels-Ober2014-11-291-1/+1
|
* Remove outdated comments [ci skip]Godfrey Chan2014-11-221-6/+0
| | | They were introduced in 23b6def; the serial stuff has been removed since a5d80f8
* Make sure assert_select can assert body tagRafael Mendonça França2014-11-182-2/+2
| | | | | | | | | 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
* edit pass over all warningsXavier Noria2014-10-281-1/+1
| | | | | | | | | | | | | | | This patch uniformizes warning messages. I used the most common style already present in the code base: * Capitalize the first word. * End the message with a full stop. * "Rails 5" instead of "Rails 5.0". * Backticks for method names and inline code. Also, converted a few long strings into the new heredoc convention.
* Parse HTML as document fragment.Kasper Timm Hansen2014-09-292-2/+2
| | | | This is to match the changes in Rails Dom Testing rails/rails-dom-testing#20.
* Remove extra 'has been' from deprecation warning about asserting selectorsPrathamesh Sonpatki2014-09-091-1/+1
| | | | [ci skip]
* Remove extra 'has been' from the deprecation messagePrathamesh Sonpatki2014-09-091-1/+1
| | | | - [ci skip]
* :scissors:Rafael Mendonça França2014-09-051-1/+1
|
* Message doesn't need to be optionalRafael Mendonça França2014-09-051-2/+2
|
* Merge pull request #14911 from estsauver/14908Rafael Mendonça França2014-09-051-7/+7
|\ | | | | | | Propagate test messages through assert_routing helper, Fixes #14908
| * Propagate test messages through assert_routing helper, Fixes #14908Earl St Sauver2014-04-291-7/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | assert_routing was not raising the message passed into the assertion violation that it raised. This change propagates messages through the on_fail error. This fixes this error: https://github.com/rails/rails/issues/14908 A test case for this issue is located here. https://github.com/estsauver/test14908 To see that test case fail in the example app, just run ruby -Itest test/controllers/guests_controller_test.rb
* | Add missing requireGodfrey Chan2014-08-181-0/+2
| |
* | Deprecate TagAssertion instead of removingRafael Mendonça França2014-08-181-0/+1
| |
* | Merge branch 'master' into loofahRafael Mendonça França2014-08-123-9/+6
|\ \ | | | | | | | | | | | | | | | | | | Conflicts: actionpack/CHANGELOG.md actionpack/test/controller/integration_test.rb actionview/CHANGELOG.md
| * | refactor Redirecting so we do not need a controller instanceAaron Patterson2014-08-061-7/+2
| | |
| * | 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
| * | ask the named routes collection if the route is definedAaron Patterson2014-07-291-1/+1
| | | | | | | | | | | | | | | we should not be accessing internals to figure out if a method is defined.
| * | 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
| | |
* | | We don't need loofah for the assertionsRafael Mendonça França2014-07-151-3/+2
| | | | | | | | | | | | We can just use nokogiri
* | | Merge pull request #11218 from kaspth/loofah-integrationRafael Mendonça França2014-07-105-597/+20
|\ \ \ | |/ / |/| | | | | | | | | | | | | | | | | 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 html_document to ActionDispatch::Assertions. Included the ↵Timm2014-06-161-1/+12
| | | | | | | | | | | | Rails::Dom::Testing::Assertions there as well.
| * | Changed deprecation message in dom and selector assertions in Action Dispatch.Timm2014-06-162-2/+2
| | |
| * | Removed tag.rb, since it is actually removed, not just deprecated. [ci skip]Timm2014-06-161-3/+0
| | |