aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/test/controller/integration_test.rb
Commit message (Collapse)AuthorAgeFilesLines
* Deprecate `request_via_redirect` method.Prathamesh Sonpatki2016-04-241-3/+5
| | | | | | | | - Followup of https://github.com/rails/rails/issues/18693. - I think we missed deprecating `request_via_redirect` in that pull request. - Originally requested by DHH here https://github.com/rails/rails/issues/18333.
* Deprecate :controller and :action path parametersAndrew White2016-03-011-5/+20
| | | | | | | | Allowing :controller and :action values to be specified via the path in config/routes.rb has been an underlying cause of a number of issues in Rails that have resulted in security releases. In light of this it's better that controllers and actions are explicitly whitelisted rather than trying to blacklist or sanitize 'bad' values.
* remove args from assert_nothing_raised in testsTara Scherner de la Fuente2016-02-221-1/+1
|
* Make `parsed_body` extract parser from the content type.Kasper Timm Hansen2016-02-111-0/+10
| | | | | | | We're not guaranteed to have a `RequestEncoder` to assign on `get` requests because we aren't extracting the parser from the response content type. Until now.
* Add `parsed_body` to spare writing out parsing routines.Kasper Timm Hansen2016-02-101-11/+24
| | | | | | | | | | | | | | | When testing: ```ruby post articles_path, params: { article: { title: 'Ahoy!' } }, as: :json ``` It's common to want to make assertions on the response body. Perhaps the server responded with JSON, so you write `JSON.parse(response.body)`. But that gets tedious real quick. Instead add `parsed_body` which will automatically parse the reponse body as what the last request was encoded `as`.
* Add `as` to encode a request as a specific mime type.Kasper Timm Hansen2016-01-041-0/+43
| | | | | | | | | | | | | | | Turns ``` post articles_path(format: :json), params: { article: { name: 'Ahoy!' } }.to_json, headers: { 'Content-Type' => 'application/json' } ``` into ``` post articles_path, params: { article: { name: 'Ahoy!' } }, as: :json ```
* Suppress warnings (warnings about AD::IntegrationTest HTTP request)yui-knk2015-10-221-1/+1
| | | | | These warings have been appeared from ea9bc06c9a47b839d5e2db94ba6bf7e29c8f0ae9.
* Merge pull request #20715 from simsalabim/feature/parse-rss-atom-as-xmlSean Griffin2015-10-201-13/+17
| | | | parse RSS/ATOM responses as XML, not HTML
* Get rid of mocha tests - part 2Marcin Olichwirowicz2015-08-251-113/+153
|
* do not add common ports to HTTP_HOSTMichael Grosser2015-08-061-0/+19
| | | | | - webservers do not do it - it makes redirect urls ugly when request.host is used for redirection
* Stop using deprecated `render :text` in testPrem Sichanugrist2015-07-171-13/+13
| | | | | | | | | This will silence deprecation warnings. Most of the test can be changed from `render :text` to render `:plain` or `render :body` right away. However, there are some tests that needed to be fixed by hand as they actually assert the default Content-Type returned from `render :body`.
* Remove `assigns` and `assert_template`.Guo Xiang Tan2015-05-301-2/+0
|
* Fix kwargs warning in `test_get_xml`eileencodes2015-03-201-1/+1
| | | | | | ActionDispatch::IntegrationTest HTTP request methods will accept only certain kwargs in the future. This test caused a deprecation warning when running ActionPack tests. Added `params` and `headers` to fix.
* Compare content_type with Mime::XML instead of regexpBoris Peterbarg2015-03-161-0/+17
| | | | | 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-0/+12
| | | | | | | | | | | | | | | 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.
* Fix default headers in test responsesJeremy Kemper2015-02-251-16/+18
| | | | | | | 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 #18771 from kirs/deprecate-xhrRafael Mendonça França2015-02-051-82/+73
|\ | | | | Migrating xhr methods to keyword arguments syntax
| * Migrating xhr methods to keyword arguments syntaxKir Shatrov2015-02-011-82/+73
| | | | | | | | | | | | | | | | | | | | | | | | 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
* Remove duplicated testsRafael Mendonça França2015-01-291-30/+0
|
* Consistent usage of spaces in hashes across our codebaseRafael Mendonça França2015-01-291-9/+9
|
* Switch to kwargs in ActionController::TestCase and ActionDispatch::IntegrationKir Shatrov2015-01-291-47/+208
| | | | | | | | 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
* Just assert the deprecation of one methodRafael Mendonça França2015-01-281-10/+15
|
* Deprecate *_via_redirect integration test methodsAditya Kapoor2015-01-281-15/+25
|
* Default headers, removed in controller actions, will not be reapplied to the ↵Jonas Baumann2015-01-091-0/+23
| | | | test response.
* Integration requests should work in contexts without setup and teardownbrainopia2015-01-021-0/+24
|
* Make sure assert_select can assert body tagRafael Mendonça França2014-11-181-3/+3
| | | | | | | | | This reverts commit f93df52845766216f0fe36a4586f8abad505cac4, reversing changes made to a455e3f4e9dbfb9630d47878e1239bc424fb7d13. Conflicts: actionpack/lib/action_controller/test_case.rb actionview/lib/action_view/test_case.rb
* Remove session to allow `with_routing` to be called twice.Guo Xiang Tan2014-11-051-0/+36
| | | | Fixes: https://github.com/rails/rails/issues/16814
* Add regression test for router was overwriting PATH_INFOArthur Neves2014-10-101-0/+8
| | | | [related #17233]
* Parse HTML as document fragment.Kasper Timm Hansen2014-09-291-3/+3
| | | | 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/+2
|\ | | | | | | | | | | | | Conflicts: actionpack/CHANGELOG.md actionpack/test/controller/integration_test.rb actionview/CHANGELOG.md
| * Rails-ish apps should descend from Rails::RailtieAaron Patterson2014-07-161-1/+2
| | | | | | | | | | Use an is_a check to ensure it's a Railsish app so we can avoid respond_to calls everywhere.
* | We don't need loofah for the assertionsRafael Mendonça França2014-07-151-3/+3
| | | | | | | | We can just use nokogiri
* | Removed require's for html-scanner.Timm2014-06-161-1/+0
| |
* | Changed tests to assert_kind_of Loofah::HTML::Document.Timm2014-06-151-3/+3
|/
* fixes stack level too deep exception on action named 'status' returning ↵Christiaan Van den Poel2014-05-151-0/+31
| | | | 'head :ok'
* Fix regression on `assert_redirected_to`.Arthur Neves2014-05-131-0/+6
| | | | | | | | | | `assert_redirected_to` would fail if there is no controller set on a `ActionDispatch::IntegrationTest`, as _compute_redirect_to_location would be called on the controller to build the url. This regression was introduced after 1dacfbabf3bb1e0a9057dd2a016b1804e7fa38c0. [fixes #14691]
* Skip Rack applications and redirects when generating urlsAndrew White2013-07-161-3/+3
| | | | | | | | | | When generating an unnamed url (i.e. using `url_for` with an options hash) we should skip anything other than standard Rails routes otherwise it will match the first mounted application or redirect and generate a url with query parameters rather than raising an error if the options hash doesn't match any defined routes. Fixes #8018
* Revert "Integration tests support the OPTIONS http method"Rafael Mendonça França2013-05-161-17/+1
| | | | | | | | | | | | | | This reverts commit ad46884af567d6f8d6d8d777f372c39e81a560ba. Conflicts: actionpack/CHANGELOG.md actionpack/lib/action_dispatch/testing/integration.rb actionpack/test/controller/integration_test.rb Reason: It will conflict with a lot of test cases. Better to call `process` directly since this is a very uncommon HTTP method. Fixes #10638.
* allow headers and env to be passed in `IntegrationTest`.Yves Senn2013-03-131-0/+15
| | | | Closes #6513.
* Make sure to reset default_url_optionsAkira Matsuda2013-01-221-1/+5
|
* Ensure port is set when passed via the process methodAndrew White2013-01-151-0/+52
|
* Move action_controller/vendor/html-scanner to action_viewPiotr Sarnacki2012-08-281-1/+1
| | | | | | This is another step in moving Action View's dependencies in Action Pack to Action View itself. Also, HtmlScanner seems to be better suited for views rather than controllers.
* Include routes.mounted_helpers into integration testsPiotr Sarnacki2012-06-011-0/+19
| | | | | | | | | | | | | | | In integration tests, you might want to use helpers from engines that you mounted in your application. It's not hard to add it by yourself, but it's unneeded boilerplate. mounted_helpers are now included by default. That means that given engine mounted like: mount Foo::Engine => "/foo", :as => "foo" you will be able to use paths from this engine in tests this way: foo.root_path #=> "/foo" (closes #6573)
* Refactor the handling of default_url_options in integration testsAndrew White2012-05-101-0/+80
| | | | | | | | | | | | This commit improves the handling of default_url_options in integration tests by making behave closer to how a real application operates. Specifically the following issues have been addressed: * Options specified in routes.rb are used (fixes #546) * Options specified in controllers are used * Request parameters are recalled correctly * Tests can override default_url_options directly
* added an integration test that checks ActionController::UnknownFormat ↵Steven Soroka2012-05-061-0/+9
| | | | renders 406 :not_acceptable
* Remove default match without specified methodJose and Yehuda2012-04-241-4/+4
| | | | | | | | | | | | | | | | In the current router DSL, using the +match+ DSL method will match all verbs for the path to the specified endpoint. In the vast majority of cases, people are currently using +match+ when they actually mean +get+. This introduces security implications. This commit disallows calling +match+ without an HTTP verb constraint by default. To explicitly match all verbs, this commit also adds a :via => :all option to +match+. Closes #5964
* Add config.default_method_for_update to support PATCHDavid Lee2012-02-221-1/+23
| | | | | | | | | | | | | | | | PATCH is the correct HTML verb to map to the #update action. The semantics for PATCH allows for partial updates, whereas PUT requires a complete replacement. Changes: * adds config.default_method_for_update you can set to :patch * optionally use PATCH instead of PUT in resource routes and forms * adds the #patch verb to routes to detect PATCH requests * adds #patch? to Request * changes documentation and comments to indicate support for PATCH This change maintains complete backwards compatibility by keeping :put as the default for config.default_method_for_update.
* Integration tests support the OPTIONS http methodJeremy Kemper2012-02-191-1/+17
|
* Exclude rack.request.form_vars from request.filtered_envChad Jolly2012-01-181-0/+33
|