aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/test
Commit message (Collapse)AuthorAgeFilesLines
...
| * | | | Do not add format key to request_paramsJorge Bejar2015-12-091-1/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | I did this change but it is affecting how the request params end up after being processed by the router. To be in the safe side, I just take the format from the extension in the URL when is not present in those params and it's being used only for the `Request#formats` method
| * | | | DebugException initialize with a response_format valueJorge Bejar2015-12-091-2/+2
| | | | |
| * | | | Fix some edge cases in AD::DebugExceptions in rails api appsJorge Bejar2015-12-091-11/+62
| | | | |
| * | | | Response when error should be formatted properly in Rails API if local requestJorge Bejar2015-12-093-4/+25
| | | | |
| * | | | Use URL path extension as format in bad params exception handlingJorge Bejar2015-12-081-1/+15
| | | | |
* | | | | Fix `make_response!` when called by `serve` in `RouteSet`eileencodes2015-12-091-0/+39
|/ / / / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | All of our tests were testing the `ActionController::Live` behavior in a standalone environment, without going through the router or behaving like a real application. This resulted in `ActionController::Live` throwing the exception `undefined method 'request' for #<ActionDispatch::Request:0x00000003ad1148>` because `make_response!` was expecting a response instead of a request. The expectation of a response came from `set_response!` in non-router tests setting the response and passing it to `make_response!`. In the case of an application we would hit `serve` in `RouteSet` first which would send us to `make_response!` with a request sent instead of a response. The changes here remove `set_response!` so `make_response!` always receives a request. Thanks to KalabiYau for help with the investigation and solution. Fixes #22524 [Eileen M. Uchitelle & KalabiYau]
* | | | Change the `protect_from_forgery` prepend default to `false`eileencodes2015-12-071-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Per this comment https://github.com/rails/rails/pull/18334#issuecomment-69234050 we want `protect_from_forgery` to default to `prepend: false`. `protect_from_forgery` will now be insterted into the callback chain at the point it is called in your application. This is useful for cases where you want to `protect_from_forgery` after you perform required authentication callbacks or other callbacks that are required to run after forgery protection. If you want `protect_from_forgery` callbacks to always run first, regardless of position they are called in your application, then you can add `prepend: true` to your `protect_from_forgery` call. Example: ```ruby protect_from_forgery prepend: true ```
* | | | Push `before_sending` to super classeileencodes2015-12-066-5/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | We want to get rid of the `Live::Response` so we are consolidating methods from `Live::Response` and `Response` by merging them together. This adds an `#empty` method to the request so we don't need to hard-code the empty array each time we call an empty `ActionDispatch::Request`. The work here is a continuation on combining controller and integration test code bases into one.
* | | | Merge pull request #22453 from wjessop/use_action_dispatch_default_tld_lengthEileen M. Uchitelle2015-12-061-26/+30
|\ \ \ \ | |/ / / |/| | | Test against the real value of tld_length unless explicitly set
| * | | Test against the real value of tld_length unless explicitly setWill Jessop2015-12-041-26/+30
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | There were two places where the tld_length default was hard-coded to 1, both overriding the real default value of ActionDispatch::Http::URL.tld_length in this set of tests. This commit removes both of those, relying on the actual value of ActionDispatch::Http::URL.tld_length, unless it's specifically overridden.
* | | | Add redirection path in the error message of assert_response if response is ↵Prathamesh Sonpatki2015-12-041-1/+16
|/ / / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | :redirect - If the assert_response is checking for any non-redirect response like :success and actual response is :redirect then, the error message displayed was - Expected response to be a <success>, but was <302> - This commit adds the redirect path to the error message of assert_response if the response is :redirect. So above message is changed to - Expected response to be a <success>, but was a redirect to <http://test.host/posts/lol>
* | | Merge pull request #22371 from yui-knk/better_mount_errorArthur Nogueira Neves2015-11-281-1/+13
|\ \ \ | | | | | | | | Brush up errors of `ActionDispatch::Routing::Mapper#mount`
| * | | Brush up errors of `ActionDispatch::Routing::Mapper#mount`yui-knk2015-11-281-1/+13
| | | | | | | | | | | | | | | | | | | | | | | | * Integrate to raise `ArgumentError` * Detailed error message when `path` is not defined * Add a test case, invalid rack app is passed
* | | | Merge pull request #21241 from pdg137/masterArthur Nogueira Neves2015-11-261-0/+7
|\ \ \ \ | | | | | | | | | | In url_for, never append ? when the query string is empty anyway.
| * | | | In url_for, never append ? when the query string is empty anyway.Paul Grayson2015-10-291-0/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | It used to behave like this: url_for(controller: 'x', action: 'y', q: {}) # -> "/x/y?" We previously avoided empty query strings in most cases by removing nil values, then checking whether params was empty. But as you can see above, even non-empty params can yield an empty query string. So I changed the code to just directly check whether the query string ended up empty. (To make everything more consistent, the "removing nil values" functionality should probably move to ActionPack's Hash#to_query, the place where empty hashes and arrays get removed. However, this would change a lot more behavior.)
* | | | | Merge pull request #22263 from mastahyeti/csrf-origin-checkRafael França2015-11-261-0/+45
|\ \ \ \ \ | | | | | | | | | | | | | | | | | | | | | | | | Add option to verify Origin header in CSRF checks [Jeremy Daer + Rafael Mendonça França]
| * | | | | Add option to verify Origin header in CSRF checksBen Toews2015-11-251-0/+45
| | | | | |
* | | | | | Merge pull request #22172 from tijmenb/fix-source-in-show-exceptionRafael França2015-11-241-0/+8
|\ \ \ \ \ \ | | | | | | | | | | | | | | Add text template for source code
| * | | | | | Add text template for source codeTijmen Brommet2015-11-031-0/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When a request is made with AJAX and an error occurs, Rails will render a text-template for the exception instead of the HTML error page (#11960). The `.text.erb` variant of the `_source` template is currently missing, causing HTML to be rendered in the response. This commit adds the text template. To keep the page scannable we only only show the first three source extracts. Related to #14745. Before: ``` ~/testing-exceptions ᐅ curl 'http://localhost:3000/' -H 'X-Requested-With: XMLHttpRequest' RuntimeError in PostsController#index <div class="source " id="frame-source-0"> <div class="info"> Extracted source (around line <strong>#3</strong>): </div> <div class="data"> <table cellpadding="0" cellspacing="0" class="lines"> <tr> ``` After: ``` ~/testing-exceptions ᐅ curl 'http://localhost:3000/' -H 'X-Requested-With: XMLHttpRequest' RuntimeError in PostsController#index Extracted source (around line #3): *3 raise ```
* | | | | | | Merge pull request #17928 from sergey-alekseev/remove-unused-form-data-methodSean Griffin2015-11-231-0/+20
|\ \ \ \ \ \ \ | |_|_|_|/ / / |/| | | | | |
| * | | | | | write a test for `#form_data?`Sergey Alekseev2015-03-311-0/+20
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The initial attempt was to remove the method at all in https://github.com/sergey-alekseev/rails/commit/4926aa68c98673e7be88a2d2b57d72dc490bc71c. The method overrides Rack's `#form_data?` https://github.com/rack/rack/blob/6f8808d4201e68e4bd780441b3b7bb3ee6d1f43e/lib/rack/request.rb#L172-L184. Which may have some incorrect implementation actually. `type.nil?` isn't possible I suppose. I'll check.
* | | | | | | Remove arity check for `RouteSet#draw`yui-knk2015-11-211-6/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This code was added for migration from Rails 3.1 to upper, now we are developing Rails 5.
* | | | | | | Fix typo [ci skip]Jake Worth2015-11-121-1/+1
| |_|/ / / / |/| | | | |
* | | | | | Require only necessary concurrent-ruby classes.Jerry D'Antonio2015-11-042-2/+2
| | | | | |
* | | | | | tests, test should not care wether 9ms or 11ms have passed.Yves Senn2015-11-041-1/+1
| |/ / / / |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This solves: ``` Expected /Completed 200 OK in [\d]ms/ to match "Completed 200 OK in 943ms". ```
* | | | | Deprecate exception#original_exception in favor of exception#causeYuki Nishijima2015-11-035-11/+31
| | | | |
* | | | | Merge pull request #21251 from rodzyn/more_param_parser_testsSean Griffin2015-10-301-0/+14
|\ \ \ \ \ | |_|/ / / |/| | | | Add test for parsing application/vnd.api+json
| * | | | Add test for parsing application/vnd.api+jsonMarcin Olichwirowicz2015-08-211-0/+14
| | | | |
* | | | | Revert "ActionController::Base#process() now only takes an action name"Aaron Patterson2015-10-291-0/+20
| | | | | | | | | | | | | | | | | | | | This reverts commit 9f93a5efbba3e1cbf0bfa700a17ec8d1ef60d7c6.
* | | | | ActionController::Base#process() now only takes an action nameAaron Patterson2015-10-291-20/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | rather than an action name and *args. The *args were not being used in regular applications outside tests. This causes a backwards compatibility issue, but reduces array allocations for most users.
* | | | | switch to JSON.dump to avoid infinite recursionAaron Patterson2015-10-291-1/+1
| | | | |
* | | | | Write the cookie jar it was not committed in TestCaseRafael Mendonça França2015-10-281-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | For ActionController::Base we write the cookies in a middleware if it was not yet committed no matter if the response was committed or not. [1] For ActionController::Live we write the cookies before the response is committed. [2] We already mimic ActionController::Live in ActionController::TestCase but we don't mimic the ActionController::Base behavior because we were checking if the response was committed before writing the cookies. Now we are matching the behavior of the middleware and writing the cookies if it was not written before. [1]: https://github.com/rails/rails/blob/80c6b901d4d87cee610ab0a438ff6e3c6bf118d1/actionpack/lib/action_dispatch/middleware/cookies.rb#L599-L604 [2]: https://github.com/rails/rails/blob/80c6b901d4d87cee610ab0a438ff6e3c6bf118d1/actionpack/lib/action_controller/metal/live.rb#L218-L223
* | | | | Remove skipped JRuby tests that are passing on 9.0.3.0.Guo Xiang Tan2015-10-273-6/+0
| | | | |
* | | | | Tweaked wording used in some tests.Sebastian McKenzie2015-10-251-2/+2
| | | | |
* | | | | Remove skip on tests that have been fixed.Guo Xiang Tan2015-10-241-4/+0
| | | | |
* | | | | Catch invalid UTF-8 querystring values and respond with BadRequestGrey Baker2015-10-231-6/+10
| | | | |
* | | | | FIX: Randomly failing test when running without GIL.Guo Xiang Tan2015-10-231-0/+6
| | | | |
* | | | | Merge pull request #19327 from rousisk/masterSean Griffin2015-10-221-2/+2
|\ \ \ \ \ | | | | | | | | | | | | Change Integer#year to return a Fixnum instead of a Float to improve consistency
| * | | | | Change Integer#year to return a Fixnum instead of a Float to improve consistencyKonstantinos Rousis2015-10-221-2/+2
| | | | | |
* | | | | | 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
* | | | | Merge pull request #22003 from yui-knk/remove_needless_require_asYves Senn2015-10-201-1/+0
|\ \ \ \ \ | | | | | | | | | | | | Delete needless `require 'active_support/deprecation'`
| * | | | | Delete needless `require 'active_support/deprecation'`yui-knk2015-10-201-1/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When `require 'active_support/rails'`, 'active_support/deprecation' is automatically loaded.
* | | | | | Show helpful messages on invalid param. encodingsAgis Anastasopoulos2015-10-191-0/+14
|/ / / / / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Prior to this change, given a route: # config/routes.rb get ':a' => "foo#bar" If one pointed to http://example.com/%BE (param `a` has invalid encoding), a `BadRequest` would be raised with the following non-informative message: ActionController::BadRequest From now on the message displayed is: Invalid parameter encoding: hi => "\xBE" Fixes #21923.
* | | | | Merge pull request #19135 from yuki24/access-control-supportJeremy Daer2015-10-131-8/+27
|\ \ \ \ \ | | | | | | | | | | | | | | | | | | Add basic support for access control headers to ActionDispatch::Static
| * | | | | Add the ability of returning arbitrary headers to ActionDispatch::StaticYuki Nishijima2015-06-131-8/+27
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Now ActionDispatch::Static can accept HTTP headers so that developers will have control of returning arbitrary headers like 'Access-Control-Allow-Origin' when a response is delivered. They can be configured through `#config.public_file_server.headers`: config.public_file_server.headers = { "Cache-Control" => "public, max-age=60", "Access-Control-Allow-Origin" => "http://rubyonrails.org" } Also deprecate `config.static_cache_control` in favor of `config.public_file_server.headers`.
* | | | | | Merge pull request #21849 from yui-knk/refactor_regexp_to_stringAndrew White2015-10-122-2/+13
|\ \ \ \ \ \ | | | | | | | | | | | | | | Change `Journey::Route#verb` to return string instead of regexp.
| * | | | | | Change `Journey::Route#verb` to return string instead of regexp.yui-knk2015-10-032-2/+13
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | By [this commit](https://github.com/rails/rails/commit/0b476de445faf330c58255e2ec3eea0f3a7c1bfc) `Journey::Route#verb` need not to return verb as regexp. The returned value is used by inspector, so change it to be a string. Add inspect_with_multiple_verbs test case to keep the behavior of inspector correctly.
* | | | | | | Use `Mime[:foo]` instead of `Mime::Type[:FOO]` for back compatJeremy Daer2015-10-0612-128/+113
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Rails 4.x and earlier didn't support `Mime::Type[:FOO]`, so libraries that support multiple Rails versions would've had to feature-detect whether to use `Mime::Type[:FOO]` or `Mime::FOO`. `Mime[:foo]` has been around for ages to look up registered MIME types by symbol / extension, though, so libraries and plugins can safely switch to that without breaking backward- or forward-compatibility. Note: `Mime::ALL` isn't a real MIME type and isn't registered for lookup by type or extension, so it's not available as `Mime[:all]`. We use it internally as a wildcard for `respond_to` negotiation. If you use this internal constant, continue to reference it with `Mime::ALL`. Ref. efc6dd550ee49e7e443f9d72785caa0f240def53
* | | | | | | move file sending to the response objectAaron Patterson2015-10-052-1/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Just a slight refactor that delegates file sending to the response object. This gives us the advantage that if a webserver (in the future) provides a response object that knows how to do accelerated file serving, it can implement this method.