aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/lib/action_dispatch/testing
Commit message (Collapse)AuthorAgeFilesLines
* [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
|
* Remove deprecated `ActionDispatch::IntegrationTest#xml_http_request`Rafael Mendonça França2016-10-101-32/+0
|
* Undefine assings in IntegrationTestRafael Mendonça França2016-10-071-0/+2
| | | | | assigns assert the state of a controller instance what should not be done in an integration test.
* Only search fixture_path for files that can't be found directlyMatthew Draper2016-09-241-1/+2
| | | | | | | | | | When passed an already-valid file name, prepending the path is likely to create problems. This is particularly relevant for #26384, which adds fixture_path handling to test classes that previously didn't have it: any existing caller must have been manually locating the file, and we don't want to break them.
* Merge pull request #26589 from kirs/ad-test-request-methodArthur Nogueira Neves2016-09-221-1/+1
|\ | | | | Fix memoization bug on ActionDispatch::TestRequest#request_method=
| * Fix memoization bug on ActionDispatch::TestRequest#request_method=Kir Shatrov2016-09-221-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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 assert_response helperKir Shatrov2016-09-141-1/+6
|/ | | | | | | | | | | | | | | | | | | | | | | | 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'"]} ```
* make `fixture_file_upload` work in integration testsyuuji.yaginuma2016-09-041-1/+3
| | | | | | | | | 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`.
* Override `respond_to_missing?` instead of `respond_to?` when possibleSean Griffin2016-08-311-1/+1
| | | | | | | | | | 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.
* 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-201-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | 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.
* Add three new rubocop rulesRafael Mendonça França2016-08-161-1/+1
| | | | | | | | Style/SpaceBeforeBlockBraces Style/SpaceInsideBlockBraces Style/SpaceInsideHashLiteralBraces Fix all violations in the repository.
* [ci skip] Link to the request helpers documentation.Kasper Timm Hansen2016-08-141-0/+3
| | | | | | It's tough for people without the knowledge of where the `get` and friends integration test helpers are defined to find documentation for them. Add a link to the main integration test documentation.
* [ci skip] Update integration test request encoding documentation.Kasper Timm Hansen2016-08-141-13/+14
| | | | | | | * Give the section a header to distinguish it from the general doc. * Replace backticks with + signs to fit SDoc. * Use double quoted strings. * Clarify how `parsed_body` works — it doesn't depend on `as` anymore.