aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/test
Commit message (Collapse)AuthorAgeFilesLines
* Use ASCII-8BIT paths in ActionDispatch::StaticAndrew White2018-03-225-1/+12
| | | | | | | | | | The rack gem returns PATH_INFO as an ASCII-8BIT encoded string but it was being converted to US-ASCII by the match? method because it was calling Rack::Utils.escape_path. To prevent incompatibile encoding warnings use ASCII-8BIT strings for the root path and let Ruby handle any filename encoding conversion. Fixes #32294, Closes #32314.
* Check exclude before flagging cookies as secure in ActionDispatch::SSL (#32262)Catherine Khuu2018-03-151-0/+8
| | | | | | | * Check exclude before flagging cookies as secure. * Update comments in ActionDispatch::SSL. [Catherine Khuu + Rafael Mendonça França]
* Fix routing inspector tests broken in ↵Kasper Timm Hansen2018-03-131-14/+15
| | | | | | | | | | https://github.com/rails/rails/commit/6629d51a2756fadf961bb09df20579cacfef2c8e * Renames grep_pattern to grep throughout. * Fixes setup not calling super by calling setup with a block. * Converts test helper method to a private one, like we have it other places. * Uses keyword arguments to get around awkward draw({ grep: "x" }, Action…) construction.
* Introduce `ActionDispatch::Routing::ConsoleFormatter::Base`bogdanvlviv2018-03-131-11/+11
| | | | | | | | | | | | | | - Create `Base` and inherit `Sheet` and `Expanded` in order to - prevent code duplication. - Remove trailing "\n" for components of `Expanded`. - There is no need for `Expanded#header` to return `@buffer` so return `nil` instead. - Change `no_routes` message "No routes were found for this controller" since if use `-g`, it sounds incorrect. - Display `No routes were found for this controller.` if apply `-c`. - Display `No routes were found for this grep pattern.` if apply `-g`. Related to #32130
* Merge pull request #32160 from bogdanvlviv/improve-rails-routes-expandedKasper Timm Hansen2018-03-111-5/+10
|\ | | | | Draw line of a route name to the end of row console on `rails routes --expanded`
| * Draw line of a route name to the end of row console on `rails routes --expanded`bogdanvlviv2018-03-051-5/+10
| | | | | | | | | | | | | | In order to get width of console use `IO::console_size`, See https://ruby-doc.org/stdlib-2.4.1/libdoc/io/console/rdoc/IO.html#method-c-console_size Related to #32130
* | Always yield a CSP policy instanceAndrew White2018-03-081-12/+58
| | | | | | | | | | If the app has the CSP disabled globally allow a controller action to enable the policy for that request.
* | Add the ability to disable the global CSP in a controllerAndrew White2018-03-081-0/+14
|/ | | | | | | | e.g: class LegacyPagesController < ApplicationController content_security_policy false, only: :index end
* 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
* Add --expanded option to "rails routes"Benoit Tigeot2018-02-281-2/+66
| | | | | | | | | | | | | | | | | | | | | | | | | When using rails routes with small terminal or complicated routes it can be very difficult to understand where is the element listed in header. psql had the same issue, that's why they created "expanded mode" you can switch using `\x` or by starting psql with ``` -x --expanded Turn on the expanded table formatting mode. This is equivalent to the \x command. ``` The output is similar to one implemented here for rails routes: db_user-# \du List of roles -[ RECORD 1 ]---------------------------------------------- Role name | super Attributes | Superuser, Create role, Create DB Member of | {} -[ RECORD 2 ]---------------------------------------------- Role name | role Attributes | Superuser, Create role, Create DB, Replication Member of | {}
* Uses the absolute path for system test screenshotsZamith2018-02-271-5/+5
| | | | | | | | | | | | | Why: * When getting an error that generates a screenshot it would be helpful to be able to ctrl+click it to quickly open it in the browser, which does not work with relative paths This change addresses the need by: * Changing `image_path` to disregard the relative path and use the absolute one instead
* Merge branch 'master' into update_default_hsts_max_ageGuillermo Iguaran2018-02-2439-260/+289
|\
| * Merge pull request #32018 from rails/add-nonce-support-to-cspAndrew White2018-02-221-0/+16
| |\ | | | | | | Add support for automatic nonce generation for Rails UJS
| | * Add support for automatic nonce generation for Rails UJSAndrew White2018-02-191-0/+16
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Because the UJS library creates a script tag to process responses it normally requires the script-src attribute of the content security policy to include 'unsafe-inline'. To work around this we generate a per-request nonce value that is embedded in a meta tag in a similar fashion to how CSRF protection embeds its token in a meta tag. The UJS library can then read the nonce value and set it on the dynamically generated script tag to enable it to execute without needing 'unsafe-inline' enabled. Nonce generation isn't 100% safe - if your script tag is including user generated content in someway then it may be possible to exploit an XSS vulnerability which can take advantage of the nonce. It is however an improvement on a blanket permission for inline scripts. It is also possible to use the nonce within your own script tags by using `nonce: true` to set the nonce value on the tag, e.g <%= javascript_tag nonce: true do %> alert('Hello, World!'); <% end %> Fixes #31689.
| * | We should call methods with `.method_name` not `::method_name`.utilum2018-02-222-5/+6
| |/ | | | | | | | | | | Found several instances. Follow up on 63d530c5e68a8cf53603744789f53ccbc7ac1a0e
| * Remove trailing semi-colon from CSPAndrew White2018-02-191-32/+32
| | | | | | | | | | | | | | | | | | Although the spec[1] is defined in such a way that a trailing semi-colon is valid it also doesn't allow a semi-colon by itself to indicate an empty policy. Therefore it's easier (and valid) just to omit it rather than to detect whether the policy is empty or not. [1]: https://www.w3.org/TR/CSP2/#policy-syntax
| * Revert "Merge pull request #32045 from eagletmt/skip-csp-header"Andrew White2018-02-191-20/+2
| | | | | | | | | | | | | | | | | | This reverts commit 86f7c269073a3a9e6ddec9b957deaa2716f2627d, reversing changes made to 5ece2e4a4459065b5efd976aebd209bbf0cab89b. If a policy is set then we should generate it even if it's empty. However what is happening is that we're accidentally generating an empty policy when the initializer is commented out by default.
| * Skip generating empty CSP header when no policy is configuredKohei Suzuki2018-02-181-2/+20
| | | | | | | | | | | | | | | | `Rails.application.config.content_security_policy` is configured with no policies by default. In this case, Content-Security-Policy header should not be generated instead of generating the header with no directives. Firefox also warns "Content Security Policy: Couldn't process unknown directive ''".
| * 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
| * Clean up and consolidate .gitignoresbogdanvlviv2018-02-171-0/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * Global ignores at toplevel .gitignore * Component-specific ignores in each toplevel directory * Remove `actionview/test/tmp/.keep` for JRuby ``` rm actionview/test/tmp/ -fr cd actionview/ bundle exec jruby -Itest test/template/digestor_test.rb ``` Related to #11743, #30392. Closes #29978.
| * Rails 6 requires Ruby 2.3+Jeremy Daer2018-02-171-16/+9
| |
| * Fix array routing constraintsfatkodima2018-02-171-2/+5
| |
| * 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.
| * Make sure assert_recognizes can still find routes mounted after enginesRafael Mendonça França2018-02-091-0/+6
| | | | | | | | | | Before, if the application defined after an engine this method would not recognize the route since it was not defined insdie the engine.
| * Consistent behavior for session and cookies with to_h and to_hash methodIgor Kasyanchuk2018-01-312-0/+7
| |
| * Allow @ in X-Request-Id headerDaniel Colson2018-01-291-0/+5
| | | | | | | | | | | | | | It makes sense to be as strict as possible with headers from the outside world, but allowing @ to support Apache's mod_unique_id (see #31644) seems OK to me
| * Use assert_empty and assert_not_emptyDaniel Colson2018-01-259-17/+17
| |
| * Use assert_predicate and assert_not_predicateDaniel Colson2018-01-2526-174/+174
| |
| * Change refute to assert_notDaniel Colson2018-01-253-12/+12
| |
| * Use respond_to test helpersDaniel Colson2018-01-257-9/+9
| |
| * Merge pull request #31713 from aellispierce/refactor-browser-optionsEileen M. Uchitelle2018-01-171-3/+4
| |\ | | | | | | Move browser config to its own class
| | * Move browser checking to its own classAshley Ellis Pierce2018-01-151-3/+4
| | |
* | | Update default HSTS max-age value to 1 yearGrant Bourque2018-01-161-2/+2
|/ / | | | | | | | | - Update the default HSTS max-age value to 31536000 seconds (1 year) to meet the minimum max-age requirement for https://hstspreload.org/.
* | Add 'Referrer-Policy' header to default headers setGuillermo Iguaran2018-01-081-2/+4
| |
* | Merge pull request #31594 from yuki24/refactor-request-testEileen M. Uchitelle2018-01-041-89/+75
|\ \ | | | | | | Refactor tests for request parameters to use more realistic setup
| * | Use more realistic setup rather than stubbingYuki Nishijima2017-12-291-89/+75
| |/ | | | | | | | | | | | | | | | | | | These assertions did matter due to the inconsistent behavior of [the #parameters method][1]. Today, it behaves consistently and they could be removed. Also, one of the methods was stubbed somewhat incorrectly, so it is better not to stub and instead, make them close to more realistic use cases. [1]: https://github.com/rails/rails/pull/13999#issuecomment-34601746
* / let drb make temprary serverNobuyoshi Nakada2017-12-291-8/+1
|/
* Generate tmpname on its ownyuuji.yaginuma2017-12-151-1/+6
| | | | | | | `make_tmpname` was removed by https://github.com/ruby/ruby/commit/25d56ea7b7b52dc81af30c92a9a0e2d2dab6ff27. In this case, we want a file name, not a `File`. So cannot use `Tempfile`. Fixes #31458
* 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-144-4/+3
| | | | | | | | Follow up of #31432.
* | Enable `Layout/SpaceBeforeComma` rubocop rule, and fixed moreRyuta Kamizono2017-12-123-4/+4
| | | | | | | | Follow up of #31390.
* | Change the system tests to set Puma as default server only when the user ↵Guillermo Iguaran2017-12-091-1/+18
| | | | | | | | haven't specified manually another server.
* | Add secure `X-Download-Options` and `X-Permitted-Cross-Domain-Policies` to ↵Guillermo Iguaran2017-12-092-3/+7
| | | | | | | | 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
| | |
* | | Add headless firefox driver to System Testsbogdanvlviv2017-12-073-0/+18
| | |
* | | 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.