aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/test/controller
Commit message (Collapse)AuthorAgeFilesLines
...
* | | | Fix rubocop violationsbogdanvlviv2018-06-151-1/+1
|/ / / | | | | | | | | | | | | | | | | | | | | | https://codeclimate.com/github/rails/rails/issues `bundle exec rubocop -a` Related to e4e1b62007fe40c4277ebc30067837a91bf25967
* | | Use Rack to generate query information under testAaron Patterson2018-06-081-2/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | `to_query` sorts parameters before encoding them. This causes a round tripping issue as noted here: https://github.com/rails/rails/issues/23997#issuecomment-328297933 https://github.com/rails/rails/issues/10529#issuecomment-328298109 https://github.com/rails/rails/pull/30558 Unfortunately, that method is being used to generate cache keys, so its results need to be stable: https://github.com/rails/rails/commit/10dec0e65e1f4d87f411b4361045eba86b121be9 However, the test harness is only using `to_query` to encode parameters before sending them to the controller so the "cache key" usecase doesn't apply here. This commit adds a test that demonstrates the round trip problems and changes the serialization strategy to use Rack for encoding the parameters rather than `to_query`.
* | | Include application/javascript when checking content_typeGabriel Jaldon2018-05-271-0/+5
| | |
* | | Fix `CustomCops/AssertNot` to allow it to have failure messageRyuta Kamizono2018-05-133-4/+4
| | | | | | | | | | | | Follow up of #32605.
* | | Reset CONTENT_LENGTH between test requestsEugene Kenny2018-05-011-0/+8
| | | | | | | | | | | | | | | | | | | | | If a POST request is followed by a GET request in a controller test, the `rack.input` and `RAW_POST_DATA` headers from the first request will be reset but the `CONTENT_LENGTH` header will leak, leading the request object in the second request to incorrectly believe it has a body.
* | | Reset RAW_POST_DATA between test requestsEugene Kenny2018-04-201-0/+8
| | | | | | | | | | | | | | | | | | `RAW_POST_DATA` is derived from the `rack.input` header, which changes with each test request. It needs to be cleared in `scrub_env!`, or all requests within the same test will see the value from the first request.
* | | Merge pull request #29286 from vinistock/create_missing_exact_template_exceptionRafael Mendonça França2018-04-202-3/+3
|\ \ \ | | | | | | | | | | | | Create MissingExactTemplate exception with separate template
| * | | Create MissingExactTemplate exception with separate templateVinicius Stock2018-04-202-3/+3
| | | |
* | | | warning: ambiguous first argument; put parentheses or a space even after `/' ↵utilum2018-04-201-1/+1
| | | | | | | | | | | | | | | | operator
* | | | Merge pull request #32593 from sdhull/fix-strong-params-permit-bangRafael Mendonça França2018-04-191-1/+4
|\ \ \ \ | | | | | | | | | | | | | | | Fixes StrongParameters `permit!` to work with nested arrays
| * | | | Fixes StrongParameters permit! to work with nested arraysSteve Hull2018-04-161-1/+4
| | | | | | | | | | | | | | | | | | | | | | | | | `permit!` is intended to mark all instances of `ActionController::Parameters` as permitted, however nested arrays of params were not being marked permitted because the method did shallow iteration. This fixes that by flattening the array before calling `permit!` on all each item.
* | | | | Replace `assert !` with `assert_not`Daniel Colson2018-04-197-13/+13
|/ / / / | | | | | | | | | | | | | | | | This autocorrects the violations after adding a custom cop in 3305c78dcd.
* | | | Fix rendering a differently-formatted partial after cachingGeorge Claghorn2018-04-131-0/+8
| | | |
* | | | Add `TestCaseTest#test_request_format_kwarg_doesnt_mutate_params` to masterbogdanvlviv2018-04-101-0/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Initially, the test was added to 5-0-stable in #32492 and a bit modified in #32506. This test ensures that request(in tests) doesn't mutate params. It was fixed since v5.1.0.beta1 by 98b8309569a326910a723f521911e54994b112fb and then on 5-0-stable by #32492. This commit adds this test to master branch in order to prevent any regressions.
* | | | Merge pull request #32441 from composerinteralia/refute-notRafael França2018-04-042-7/+7
|\ \ \ \ | | | | | | | | | | Add custom RuboCop for `assert_not` over `refute`
| * | | | Autocorrect `refute` RuboCop violationsDaniel Colson2018-04-032-7/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 73e7aab behaved as expected on codeship, failing the build with exactly these RuboCop violations. Hopefully `rubocop -a` will have been enough to get a passing build!
* | | | | Merge pull request #32336 from vincedevendra/allow_mutating_dig_return_valueAaron Patterson2018-04-021-0/+8
|\ \ \ \ \ | |/ / / / |/| | | | Make mutating params#dig return value mutate underlying params
| * | | | Make mutating params#dig mutate underlying paramsVince DeVendra2018-03-241-0/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When #dig was called on a params object and return either a Hash or an Array, and that value was subsquently mutated, it would not modify the containing params object. That means that the behavior of `params.dig(:a, :b)[:c] = 1` did not match either `params[:a][:b][:c] = 1` nor `hash.dig(:a, :b)[:c] = 1`. Similarly to `ActionController::Parameters#[]`, use `#convert_hashes_to_parameters` to pre-convert values and insert them in the receiving params object prior to returning them.
* | | | | Deprecate controller level force_sslDerek Prior2018-03-302-15/+29
|/ / / / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Today there are two common ways for Rails developers to force their applications to communicate over HTTPS: * `config.force_ssl` is a setting in environment configurations that enables the `ActionDispatch::SSL` middleware. With this middleware enabled, all HTTP communication to your application will be redirected to HTTPS. The middleware also takes care of other best practices by setting HSTS headers, upgrading all cookies to secure only, etc. * The `force_ssl` controller method redirects HTTP requests to certain controllers to HTTPS. As a consultant, I've seen many applications with misconfigured HTTPS setups due to developers adding `force_ssl` to `ApplicationController` and not enabling `config.force_ssl`. With this configuration, many application requests can be served over HTTP such as assets, requests that hit mounted engines, etc. In addition, because cookies are not upgraded to secure only in this configuration and HSTS headers are not set, it's possible for cookies that are meant to be secure to be sent over HTTP. The confusion between these two methods of forcing HTTPS is compounded by the fact that they share an identical name. This makes finding documentation on the "right" method confusing. HTTPS throughout is quickly becomming table stakes for all web sites. Sites are expected to operate over HTTPS for all communication, sensitive or otherwise. Let's encourage use of the broader-reaching `ActionDispatch::SSL` middleware and elminate this source of user confusion. If, for some reason, applications need to expose certain endpoints over HTTP they can do so by properly configuring `config.ssl_options`.
* | | | Ruby 2.4: take advantage of String#unpack1Jeremy Daer2018-03-011-1/+1
| | | | | | | | | | | | | | | | | | | | https://bugs.ruby-lang.org/issues/12752 https://ruby-doc.org/core-2.4.0/String.html#method-i-unpack1
* | | | We should call methods with `.method_name` not `::method_name`.utilum2018-02-222-5/+6
| | | | | | | | | | | | | | | | | | | | | | | | Found several instances. Follow up on 63d530c5e68a8cf53603744789f53ccbc7ac1a0e
* | | | Rails 6 requires Ruby 2.4.1+Jeremy Daer2018-02-172-2/+0
| | | | | | | | | | | | | | | | | | | | | | | | Skipping over 2.4.0 to sidestep the `"symbol_from_string".to_sym.dup` bug. References #32028
* | | | Rails 6 requires Ruby 2.3+Jeremy Daer2018-02-171-16/+9
| | | |
* | | | Remove usage of strip_heredoc in the framework in favor of <<~Rafael Mendonça França2018-02-161-3/+2
|/ / / | | | | | | | | | | | | Some places we can't remove because Ruby still don't have a method equivalent to strip_heredoc to be called in an already existent string.
* | | Use assert_empty and assert_not_emptyDaniel Colson2018-01-256-11/+11
| | |
* | | Use assert_predicate and assert_not_predicateDaniel Colson2018-01-2519-116/+116
| | |
* | | Change refute to assert_notDaniel Colson2018-01-253-12/+12
| | |
* | | Use respond_to test helpersDaniel Colson2018-01-254-5/+5
| | |
* | | Suppress `warning: BigDecimal.new is deprecated`Yasuo Honda2017-12-151-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | `BigDecimal.new` has been deprecated in BigDecimal 1.3.3 which will be a default for Ruby 2.5. Refer https://github.com/ruby/bigdecimal/commit/533737338db915b00dc7168c3602e4b462b23503 * This commit has been made as follows: ``` cd rails git grep -l BigDecimal.new | grep -v guides/source/5_0_release_notes.md | grep -v activesupport/test/xml_mini_test.rb | xargs sed -i -e "s/BigDecimal.new/BigDecimal/g" ``` - `activesupport/test/xml_mini_test.rb` Editmanually to remove `.new` and `::` - guides/source/5_0_release_notes.md This is a Rails 5.0 release notes.
* | | Merge pull request #31289 from witlessbird/fips-compatibilityEileen M. Uchitelle2017-12-142-2/+2
|\ \ \ | | | | | | | | Initial support for running Rails on FIPS-certified systems
| * | | Introduced `ActiveSupport::Digest` that allows to specify hash function ↵Dmitri Dolguikh2017-12-122-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | implementation and defaults to `Digest::MD5`. Replaced calls to `::Digest::MD5.hexdigest` with calls to `ActiveSupport::Digest.hexdigest`.
* | | | Enable `Layout/LeadingCommentSpace` to not allow cosmetic changes in the futureRyuta Kamizono2017-12-142-2/+1
| | | | | | | | | | | | | | | | Follow up of #31432.
* | | | Enable `Layout/SpaceBeforeComma` rubocop rule, and fixed moreRyuta Kamizono2017-12-122-3/+3
| | | | | | | | | | | | | | | | Follow up of #31390.
* | | | Add secure `X-Download-Options` and `X-Permitted-Cross-Domain-Policies` to ↵Guillermo Iguaran2017-12-091-1/+1
| | | | | | | | | | | | | | | | default headers set.
* | | | Merge pull request #30780 from ↵Sean Griffin2017-12-071-0/+13
|\ \ \ \ | | | | | | | | | | | | | | | | | | | | JackMc/fix-chrome-referrer-invalidauthenticitytoken Fix issue #30658 by checking explicitly for 'null' referrer
| * | | | Add a better error message when a "null" Origin header occursJack McCracken2017-11-031-0/+13
| | | | |
* | | | | Correct routing test spelling mistake.Philip Tolton2017-12-061-1/+1
| | | | |
* | | | | Yield array from AC::Parameters#each for block with one argDominic Cleal2017-12-061-0/+16
| |/ / / |/| | | | | | | | | | | Matches Hash#each behaviour as used in Rails 4.
* | | | Update send_file headers test to use mp4 as example instead of mpgGuillermo Iguaran2017-11-281-1/+1
| | | |
* | | | Merge pull request #31099 from nobu/patch-1Rafael Mendonça França2017-11-091-1/+1
|\ \ \ \ | |/ / / |/| | | | | | | Use `Tempfile.create`
| * | | Use `Dir.mktmpdir`Nobuyoshi Nakada2017-11-091-1/+1
| | | | | | | | | | | | | | | | As `@cache_path` is expected to be a directory name, use `Dir.mktmpdir`. And omit unnecessary `Dir.tmpdir`.
| * | | Use `Tempfile.create`Nobuyoshi Nakada2017-11-091-1/+1
|/ / / | | | | | | Instead of `Dir::Tmpname.make_tmpname`, an internal method which does not guarantee uniqueness, use `Tempfile.create`.
* | | Merge pull request #31004 from shuheiktgw/remove_unnecessary_returnsRafael França2017-10-311-1/+1
|\ \ \ | | | | | | | | Remove redundant return statements
| * | | removed unnecessary returnsShuhei Kitagawa2017-10-281-1/+1
| | | |
* | | | Merge pull request #31005 from shuheiktgw/remove_unnecessary_semicolonsMatthew Draper2017-10-283-8/+8
|\ \ \ \ | |/ / / |/| | | | | | | Removed unnecessary semicolons
| * | | removed unnecessary semicolonsShuhei Kitagawa2017-10-282-7/+7
|/ / /
* | | checking for nested attributes when attribute names specified to wrap them ↵Kelton Manzanares2017-10-251-0/+14
| | | | | | | | | | | | as well
* | | Add allow_other_host option to redirect_back methodTim Masliuchenko2017-10-101-0/+21
| | |
* | | Remove `:api:` tag that has leaked on the doc directly [ci skip]Ryuta Kamizono2017-09-301-3/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Currently `:api:` tag has leaked on the doc directly since RDoc doesn't support `:api:` tag directive. http://api.rubyonrails.org/v5.1/classes/AbstractController/Rendering.html So `:api: private` doesn't work as expected. We are using `:nodoc:` for the purpose. Related #13989.
* | | Add key rotation cookies middlewareMichael Coyne2017-09-242-2/+6
| | | | | | | | | | | | | | | | | | Using the action_dispatch.cookies_rotations interface, key rotation is now possible with cookies. Thus the secret_key_base as well as salts, ciphers, and digests, can be rotated without expiring sessions.