aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/lib/action_dispatch/testing
Commit message (Collapse)AuthorAgeFilesLines
* Allow using parsed_body in ActionController::TestCaseTobias Bühlmann2018-12-161-6/+5
| | | | | | | | | | | | … by switching the initialzation of an appropriate response parser in `ActionDispatch::TestResponse` from eagerly to lazily. By doing so, the response parser can be correctly set for `ActionController::TestCase`, which doesn't include the content type header in the constructor but only sets it at a later time. Fixes #34676.
* Revert "Merge pull request #33970 from rails/eager-url-helpers"schneems2018-10-031-27/+10
| | | | | | | Until #34050 can be resolved This reverts commit 7f870a5ba2aa9177aa4a0e03a9d027928ba60e49, reversing changes made to 6556898884d636c59baae008e42783b8d3e16440.
* Eagerly build the routing helper module after routes are committedAaron Patterson2018-09-251-10/+27
| | | | | | | | | | | | | | This commit eagerly builds the route helper module after the routes have been drawn and finalized. This allows us to cache the helper module but not have to worry about people accessing the module while route definition is "in-flight", and automatically deals with cache invalidation as the module is regenerated anytime someone redraws the routes. The restriction this commit introduces is that the url helper module can only be accessed *after* the routes are done being drawn. Refs #24554 and #32892
* Merge pull request #33973 from rails/remove-catch-allAaron Patterson2018-09-251-0/+5
|\ | | | | Remove deprecated catch-all route in the AV tests
| * Add hack to deal with warningsAaron Patterson2018-09-241-1/+1
| | | | | | | | | | We should be able to remove this once the catch-all route is gone from AP
| * Remove deprecated catch-all route in the AV testsAaron Patterson2018-09-241-0/+5
| | | | | | | | | | | | | | | | This commit removes a deprecated catch-all route in the AV tests. It defines and includes the necessary routes for each test such that we don't need the catch-all anymore. This also helps push us toward #33970
* | Enable `Performance/UnfreezeString` copyuuji.yaginuma2018-09-231-3/+2
|/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | In Ruby 2.3 or later, `String#+@` is available and `+@` is faster than `dup`. ```ruby # frozen_string_literal: true require "bundler/inline" gemfile(true) do source "https://rubygems.org" gem "benchmark-ips" end Benchmark.ips do |x| x.report('+@') { +"" } x.report('dup') { "".dup } x.compare! end ``` ``` $ ruby -v benchmark.rb ruby 2.5.1p57 (2018-03-29 revision 63029) [x86_64-linux] Warming up -------------------------------------- +@ 282.289k i/100ms dup 187.638k i/100ms Calculating ------------------------------------- +@ 6.775M (± 3.6%) i/s - 33.875M in 5.006253s dup 3.320M (± 2.2%) i/s - 16.700M in 5.032125s Comparison: +@: 6775299.3 i/s dup: 3320400.7 i/s - 2.04x slower ```
* Clarify example of the test [ci skip] 黄松2018-08-251-2/+2
| | | ActionDispatch::TestProcess::FixtureFile
* Enable Start/EndWith and RegexpMatch copsBart de Water2018-07-282-3/+3
| | | | | In cases where the MatchData object is not used, this provides a speed-up: https://github.com/JuanitoFatas/fast-ruby/#stringmatch-vs-stringmatch-vs-stringstart_withstringend_with-code-start-code-end
* Prevent `RequestEncoder#encode_params` to parse falsey paramsAlireza Bashiri2018-07-201-1/+1
| | | | | | | | | | | | | | When a `get` method called with `as: :json` and `params: nil` or `params: false` (explicitly or implicitly) `RequestEncoder#encode_params` converts it into a `null` or `false` value which includes a unexpected `null=` or `false` query string into request URL. From now on `RequestEncoder#encode_params` checks whether `params` is nil or not otherwise returns. Move down `nil` conversion guard Update CHANGELOG.md
* Pass along arguments to underlying `get` method in `follow_redirect!` (#33299)Remo Fritzsche2018-07-051-3/+4
| | | | | | | | | | | | | | | | * Allow get arguments for follow_redirect Now all arguments passed to `follow_redirect!` are passed to the underlying `get` method. This for example allows to set custom headers for the redirection request to the server. This is especially useful for setting headers that may, outside of the testing environment, be set automatically on every request, i.e. by a web application firewall. * Allow get arguments for follow_redirect [Remo Fritzsche + Rafael Mendonça França]
* Merge pull request #29955 from padi/update_actiondispatch_integration_docsRyuta Kamizono2018-05-041-0/+6
|\ | | | | | | | | Updates documentation on ActionDispatch::Integration::Session#process [ci skip]
| * Updates (rdoc) documentation on ActionDispatch::Integration::Session#processMarc Rendl Ignacio2017-07-271-0/+6
| | | | | | | | | | | | Adds missing information on 2 parameters: +xhr+ and +as+ [ci skip]
* | [Action Pack] require => require_relativeAkira Matsuda2017-10-213-4/+4
| | | | | | | | | | This basically reverts e9fca7668b9eba82bcc832cb0061459703368397, d08da958b9ae17d4bbe4c9d7db497ece2450db5f, d1fe1dcf8ab1c0210a37c2a78c1ee52cf199a66d, and 68eaf7b4d5f2bb56d939f71c5ece2d61cf6680a3
* | [ci skip]Enable link to ActionDispatch::Integration::Session#process in rdocwillnet2017-10-121-12/+12
| |
* | Use tt in doc for ActionPack [ci skip]Yoshiyuki Hirano2017-08-261-1/+1
| |
* | Deprecate ActionDispatch::TestResponse response aliasesTrevor Wistaff2017-08-071-3/+21
| | | | | | | | https://github.com/rails/rails/issues/30072
* | Use frozen string literal in actionpack/Kir Shatrov2017-07-299-0/+18
|/
* Merge branch 'master' into require_relative_2017Xavier Noria2017-07-021-1/+1
|\
| * Revert "Merge pull request #29540 from kirs/rubocop-frozen-string"Matthew Draper2017-07-029-9/+0
| | | | | | | | | | This reverts commit 3420a14590c0e6915d8b6c242887f74adb4120f9, reversing changes made to afb66a5a598ce4ac74ad84b125a5abf046dcf5aa.
| * Merge pull request #29540 from kirs/rubocop-frozen-stringMatthew Draper2017-07-029-0/+9
| |\ | | | | | | | | | Enforce frozen string in Rubocop
| | * Enforce frozen string in RubocopKir Shatrov2017-07-019-0/+9
| | |
| * | Merge pull request #29506 from pat/frozen-string-literalsMatthew Draper2017-07-021-1/+1
| |\ \ | | |/ | |/| | | | Make ActiveSupport frozen-string-literal friendly.
| | * Make ActionView frozen string literal friendly.Pat Allan2017-06-201-1/+1
| | | | | | | | | | | | Plus a couple of related ActionPack patches.
* | | [Action Dispatch] require => require_relativeAkira Matsuda2017-07-013-4/+4
|/ /
* | Calling `follow_redirect!` does not reset the `html_document`:Edouard CHIN2017-06-261-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | - When making a request to a controller that redirects, `follow_redirect!` would not reset the `html_document` ivar, it only resets the `html_document` ivar from the session (not the runner) - If one was doing something like this; ```ruby get '/redirect' assert_select 'you are being redirected' follow_redirect! # html_document is memoized and doesn't get reset ``` - To fix the issue we can do the same for any other methods (`get`, `post`...) and define a method in the runner that delegates to the session but clears the html_document_first - Fixes #29367
* | Removed reference to unexisting methods:Edouard CHIN2017-06-231-2/+1
|/ | | | `get/post_via_redirect`, `xhr` and his alias `xml_http_request` were respectively removed in 092033d59f7e2b248f6c6ab6c0b67339c5e9f2df and eb52e5d42fbdc9288925a402dcb3c5664d1125b7
* `respond_to_missing?` should be privateRyuta Kamizono2017-04-221-5/+6
| | | | | | | Follow up of 03d3f036. Some of `respond_to?` were replaced to `respond_to_missing?` in 03d3f036. But the visibility is still public. It should be private.
* Merge pull request #28394 from shime/docs-action-dispatchXavier Noria2017-03-224-11/+9
|\ | | | | [docs] fix ActionDispatch documentation
| * [docs] fix ActionDispatch documentationHrvoje Šimić2017-03-134-11/+9
| |
* | Cleanup documentation fixes (#28460)Vipul A M2017-03-171-3/+3
| |
* | Updates incorrect documentation [ci skip]Dmitriy Budnik2017-03-161-4/+3
| | | | | | | | | | Looking on code for this method it's clear that it's just returns `response.status` instead of full `response` object. It's better to correct docs as probably lots of specs are relying on this behavior.
* | Fix Typo [ci skip]Olivier2017-03-131-1/+1
|/ | | Arcticle --> Article
* Remove unused requireRyuta Kamizono2017-02-121-1/+0
| | | | | | These files are not using `strip_heredoc`. Closes #27976
* Reduce string objects by using \ instead of + or << for concatenating stringsAkira Matsuda2017-01-121-2/+2
| | | | (I personally prefer writing one string in one line no matter how long it is, though)
* String#end_with? should be faster than Regexp hereAkira Matsuda2017-01-051-1/+1
|
* fix with_routing when testing api only controllersJulia López2016-12-291-2/+5
|
* Only move fixture_file_upload to IntegrationTestMatthew Draper2016-12-072-18/+22
| | | | | The rest of the helpers are better placed on Session -- and this is the only one that cares which class it is defined on.
* [ci skip] Update the `as` docs.Kasper Timm Hansen2016-11-271-1/+2
| | | | Mention the Accept header and how that figures into the request format.
* Remove default argument value.Kasper Timm Hansen2016-11-271-1/+1
| | | | Wrongly added when fixing the request path wrangling.
* [ci skip] Explain only :json is shipped by default.Kasper Timm Hansen2016-11-231-1/+2
| | | | | | | Don't want to add defensive programming to this fairly simple thing. Fixes #27060.
* Use accept header instead of mangling request path.Kasper Timm Hansen2016-11-232-22/+19
| | | | | | | | | | | | | | Instead of appending a format to the request, it's much better to just pass a more appropriate accept header. Rails will figure out the format from that instead. This allows devs to use `:as` on routes that don't have a format. Introduce an `IdentityEncoder` to avoid `if request_encoder`, essentially a better version of the purpose of the `WWWFormEncoder`. One that makes conceptual sense on GET requests too. Fixes #27144.
* Fix `ActionDispatch::IntegrationTest#open_session`Tawan Sierek2016-11-181-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Reset a new session directly after its creation in `ActionDispatch::IntegrationTest#open_session`. Reset the session to a clean state before making it available to the client's test code. Issue #22742 reports unexpected behavior of integration tests that run multiple sessions. For example an `ActionDispatch::Flash` instance is shared across multiple sessions, though a client code will rightfully assume that each new session has its own flash hash. The following test failed due to this behavior: class Issue22742Test < ActionDispatch::IntegrationTest test 'issue #22742' do integration_session # initialize first session a = open_session b = open_session refute_same(a.integration_session, b.integration_session) end end Instead of creating a new `ActionDispatch::Integration::Session` instance, the same instance is shared across all newly opened test sessions. This is due to the way how new test sessions are created in `ActionDispatch::IntegrationTest#open_session`. The already existing `ActionDispatch::IntegrationTest` instance is duplicated with `Object#dup`, This approach was introduced in commit 15c31c7639b. `Object#dup` copies the instance variables, but not the objects they reference. Therefore this issue only occurred when the current test instance had been tapped in such a way that the instance variable `@integration_session` was initialized before creating the new test session. Close #22742 [Tawan Sierek + Sina Sadeghian]
* Add more rubocop rules about whitespacesRafael Mendonça França2016-10-293-5/+5
|
* Revert "Undefine assings in IntegrationTest"Rafael Mendonça França2016-10-211-2/+0
| | | | | | This reverts commit 5dde413e1d14c42eb87071db20d075a7b962cb01. Reason: The gem defines it so we don't need to remove
* /s/integrations/integration [ci skip] (#26801)प्रथमेश Sonpatki2016-10-161-1/+1
|
* Copy-edit the documentationRafael Mendonça França2016-10-151-4/+4
| | | | [ci skip]
* Make `process` a non-private method and update documentation.Zach Aysan2016-10-151-98/+100
|
* Remove deprecated support to non-keyword arguments in ↵Rafael Mendonça França2016-10-101-42/+11
| | | | | | `ActionDispatch::IntegrationTest`, `#process`, `#get`, `#post`, `#patch`, `#put`, `#delete`, and `#head`.
* Remove deprecated `ActionDispatch::IntegrationTest#*_via_redirect`.Rafael Mendonça França2016-10-101-53/+0
|