aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/test/controller/integration_test.rb
Commit message (Collapse)AuthorAgeFilesLines
* Remove mona lisa image from the testsRafael Mendonça França2016-10-251-2/+2
| | | | | This image has copyright that we are not giving so it is better to use one image that we own the copyright.
* Revert "Undefine assings in IntegrationTest"Rafael Mendonça França2016-10-211-8/+0
| | | | | | This reverts commit 5dde413e1d14c42eb87071db20d075a7b962cb01. Reason: The gem defines it so we don't need to remove
* Remove deprecated support to non-keyword arguments in ↵Rafael Mendonça França2016-10-101-55/+0
| | | | | | `ActionDispatch::IntegrationTest`, `#process`, `#get`, `#post`, `#patch`, `#put`, `#delete`, and `#head`.
* Remove deprecated `ActionDispatch::IntegrationTest#*_via_redirect`.Rafael Mendonça França2016-10-101-89/+0
|
* Remove deprecated `ActionDispatch::IntegrationTest#xml_http_request`Rafael Mendonça França2016-10-101-102/+4
|
* Undefine assings in IntegrationTestRafael Mendonça França2016-10-071-0/+8
| | | | | assigns assert the state of a controller instance what should not be done in an integration test.
* make `fixture_file_upload` work in integration testsyuuji.yaginuma2016-09-041-0/+36
| | | | | | | | | 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`.
* Add three new rubocop rulesRafael Mendonça França2016-08-161-16/+16
| | | | | | | | Style/SpaceBeforeBlockBraces Style/SpaceInsideBlockBraces Style/SpaceInsideHashLiteralBraces Fix all violations in the repository.
* code gardening: removes redundant selfsXavier Noria2016-08-081-1/+1
| | | | | | | | | A few have been left for aesthetic reasons, but have made a pass and removed most of them. Note that if the method `foo` returns an array, `foo << 1` is a regular push, nothing to do with assignments, so no self required.
* Fix Accept header overridden when "xhr: true" in integration testDavid Chen2016-08-071-0/+13
| | | | | | | | | | | | | | | | | | | | | | | | In integration test when specify the "Accept" header with "xhr: true" option, the Accept header is overridden with a default xhr Accept header. The issue only affects HTTP header "Accept" but not CGI variable "HTTP_ACCEPT". For example: get '/page', headers: { 'Accept' => 'application/json' }, xhr: true # This is WRONG! And the response.content_type is also affected. # It should be "application/json" assert_equal "text/javascript, text/html, ...", request.accept assert_equal 'text/html', response.content_type The issue is in `ActionDispatch::Integration::RequestHelpers`. When setting "xhr: true" the helper sets a default HTTP_ACCEPT if blank. But the code doesn't consider supporting both HTTP header style and CGI variable style. For detail see this GitHub issue: https://github.com/rails/rails/issues/25859
* applies remaining conventions across the projectXavier Noria2016-08-061-1/+0
|
* modernizes hash syntax in actionpackXavier Noria2016-08-061-20/+20
|
* applies new string literal convention in actionpack/testXavier Noria2016-08-061-182/+182
| | | | | The current code base is not uniform. After some discussion, we have chosen to go with double quotes by default.
* Fix GET JSON integration test request to use method overrideeileencodes2016-08-051-0/+16
| | | | | | | | | | | | | | | | | | When a `GET` request is sent `as: :json` in an integration test the test should use Rack's method override to change to a post request so the paramters are included in the postdata. Otherwise it will not encode the parameters correctly for the integration test. Because integration test sets up it's own middleware, `Rack::MethodOverride` needs to be included in the integration tests as well. `headers ||= {}` was moved so that headers are never nil. They should default to a hash. Fixes #26033 [Eileen M. Uchitelle & Aaron Patterson]
* Test that ActionDispatch::IntegrationTest does not leak parametersNick Sieger2016-07-281-0/+14
|
* There are some cases where @@app is not definedSantiago Pastorino2016-07-261-19/+0
|
* Be more explicit with the expected resultSantiago Pastorino2016-07-261-1/+1
|
* Return ActionDispatch.test_app when no app is set on IntegrationTest.app methodSantiago Pastorino2016-07-261-0/+19
| | | | Fixes #25926
* make `as` option work with get parametersyuuji.yaginuma2016-06-251-0/+14
| | | | | | | | Currently, if path is a relative path, add format without the discrimination of the query. Therefore, if there is a query, format at end of the query would been added, format was not be specified correctly. This fix add format to end of path rather than query.
* Add regression test to `as` option.Kasper Timm Hansen2016-06-071-0/+16
| | | | | Was worried the `as` might impede on users doing the long form JSON response encoding; test for certainty.
* 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.