aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/lib/action_dispatch/testing
Commit message (Collapse)AuthorAgeFilesLines
...
* 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.
* Compare content_type with Mime::XML instead of regexpBoris Peterbarg2015-03-161-1/+1
| | | | | Regexp is broken for both content types including charsets and for integration tests, where the content_type is a Mime::Type and not String
* 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 work arounds for upstream Ruby 2.2.0 kwargs bugGenadi Samokovarov2015-03-051-1/+1
| | | | | | | | | | | | | | | | | | | 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.
* Work around for upstream Ruby bug #10685Genadi Samokovarov2015-03-011-1/+1
| | | | | | | | | | | | | | | | | | | | | 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') ```
* 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.