aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/test/controller/integration_test.rb
Commit message (Collapse)AuthorAgeFilesLines
* Correct spellingBenjamin Fleischer2017-02-051-1/+1
| | | | | | | ``` go get -u github.com/client9/misspell/cmd/misspell misspell -w -error -source=text . ```
* `self.` is not needed when calling its own instance methodAkira Matsuda2017-01-051-2/+2
| | | | Actually, private methods cannot be called with `self.`, so it's not just redundant, it's a bad habit in Ruby
* "Use assert_nil if expecting nil. This will fail in minitest 6."Akira Matsuda2016-12-251-2/+2
|
* use public Module#include instead of send :includeyuuji.yaginuma2016-11-271-1/+1
| | | | Follow up to #18767
* Use accept header instead of mangling request path.Kasper Timm Hansen2016-11-231-2/+25
| | | | | | | | | | | | | | 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/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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-291-6/+6
|
* 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
|