aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/test/controller/url_for_test.rb
Commit message (Collapse)AuthorAgeFilesLines
* Revert "Don't handle params option in a special way in url_for helper"Rafael Mendonça França2019-01-161-0/+8
| | | | | | | | | | | This reverts commit e385e4678fc64be6e176c3bdac6641db9fe48d85. While this option was undocumented it exists to make possible to pass parameters to the route helpers that are reserved like `:domain`. While `url_for(domain: 'foo.com')` would generate a URL in the `foo.com` domain `url_for(params: { domain: 'foo.com' })` would generate a URL with `?domain=foo.com`.
* Use respond_to test helpersDaniel Colson2018-01-251-1/+1
|
* Use frozen string literal in actionpack/Kir Shatrov2017-07-291-0/+2
|
* Revert "Merge pull request #29540 from kirs/rubocop-frozen-string"Matthew Draper2017-07-021-1/+0
| | | | | This reverts commit 3420a14590c0e6915d8b6c242887f74adb4120f9, reversing changes made to afb66a5a598ce4ac74ad84b125a5abf046dcf5aa.
* Enforce frozen string in RubocopKir Shatrov2017-07-011-0/+1
|
* Reuse the Parameters#to_h check in the routing helpersRafael Mendonça França2017-04-181-1/+1
| | | | | Since this protection is now in Parameters we can use it instead of reimplementing again.
* `self.` is not needed when calling its own instance methodAkira Matsuda2017-01-051-1/+1
| | | | Actually, private methods cannot be called with `self.`, so it's not just redundant, it's a bad habit in Ruby
* Use `next` instead of `break`; avoid terminating whole loopJon Moss2016-12-291-0/+21
| | | | | | | | | | | | | | We want to avoid terminating the whole loop here, because it will cause parameters that should be removed to not be removed, since we are terminating early. In this specific case, `param2` is processed before `param1` due to the reversing of `route.parts`, and since `param2` fails the check on this line, it would previously cause the whole loop to fail, and `param1` would still be in `parameterized_parts`. Now, we are simply calling `next`, which is the intended behavior. Introduced by 8ca8a2d773b942c4ea76baabe2df502a339d05b1. Fixes #27454.
* Add more rubocop rules about whitespacesRafael Mendonça França2016-10-291-5/+5
|
* Add three new rubocop rulesRafael Mendonça França2016-08-161-23/+23
| | | | | | | | Style/SpaceBeforeBlockBraces Style/SpaceInsideBlockBraces Style/SpaceInsideHashLiteralBraces Fix all violations in the repository.
* remove redundant curlies from hash argumentsXavier Noria2016-08-061-8/+8
|
* modernizes hash syntax in actionpackXavier Noria2016-08-061-69/+69
|
* applies new string literal convention in actionpack/testXavier Noria2016-08-061-141/+141
| | | | | The current code base is not uniform. After some discussion, we have chosen to go with double quotes by default.
* Deprecate :controller and :action path parametersAndrew White2016-03-011-3/+12
| | | | | | | | 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.
* Prevent ActionController::Parameters from being passed to url_for directlyJean Boussier2015-12-151-0/+7
|
* `url_for` does not modify polymorphic optionsBernerd Schaefer2015-09-041-0/+20
| | | | | | | | | | | | | | | | | The `url_for` methods in `actionpack` and `actionview` now make a copy of the provided options before generating polymorphic paths or URLs. The bug in the previous behavior is most noticeable in a case like: url_options = [:new, :post, param: 'value'] if current_page?(url_options) css_class = "active" end link_to "New Post", url_options, class: css_class
* pass a config to the route setAaron Patterson2015-03-051-6/+10
| | | | | This way we can get the relative_url_root from the application without setting another global value
* Fallback to RAILS_RELATIVE_URL_ROOT in `url_for`.Yasyf Mohamedali2015-02-241-0/+10
| | | | | | Fixed an issue where the `RAILS_RELATIVE_URL_ROOT` environment variable is not prepended to the path when `url_for` is called. If `SCRIPT_NAME` (used by Rack) is set, it takes precedence.
* Merge branch 'nil_script_name'Santiago Pastorino2014-11-251-0/+7
|\
| * Add regression test case to ensure script_name as nil is not used anymore in ↵Santiago Pastorino2014-11-251-0/+7
|/ | | | url_for
* Anchor should not be appended when set to nil/false.Guo Xiang Tan2014-11-231-0/+14
| | | | Fixes https://github.com/rails/rails/issues/17714.
* Remove useless `only_path: true` in path helpersGodfrey Chan2014-11-101-3/+2
| | | | | | We added a deprecation warning for these cases in aa1fadd, so these are now causing deprecation warnings in the test output. AFAICT, in these two cases, the option is not integral to the purpose of the test, so they can be safely removed
* Expectations firstAkira Matsuda2014-08-181-15/+15
|
* helper methods are public, so we can just call themAaron Patterson2014-07-171-4/+4
| | | | | also if you want a path from a named helper, you should call helper_path, not helper_url(:only_path => true).
* use Ruby for mockingAaron Patterson2014-06-121-1/+1
|
* Revert "Rewrite journey routes formatter for performance"Aaron Patterson2014-05-191-0/+20
| | | | | | | | | | This reverts commit 5c224de9e110763ec7a0f01f5b604bcf81f40bfb. Conflicts: actionpack/lib/action_dispatch/journey/visitors.rb 5c224de9e110763ec7a0f01f5b604bcf81f40bfb introduced a bug in the formatter. This commit includes a regression test.
* ActionDispatch::Http::URL.normalize_port should not strip port for protocol ↵Guilherme Cavalcanti2014-05-111-0/+12
| | | | relative URL.
* Remove outdated TODO from url_for test, this test was fixed in 900a2d30Zachary Scott2014-02-091-3/+0
|
* Take Hash with options inside Array in #url_forAndrey Ognevsky2013-11-151-0/+18
|
* Passing subdomain: '' to url_for removes the subdomain (instead of adding a ↵Derek Watson2013-04-181-0/+7
| | | | | | leading .) Adding a boolean route constraint checks for presence/absence of request property
* Namespace HashWithIndifferentAccessAkira Matsuda2013-01-071-3/+2
|
* Remove warning renaming the test classes to use the test conventionRafael Mendonça França2012-07-291-1/+1
|
* Remove default match without specified methodJose and Yehuda2012-04-241-8/+8
| | | | | | | | | | | | | | | | In the current router DSL, using the +match+ DSL method will match all verbs for the path to the specified endpoint. In the vast majority of cases, people are currently using +match+ when they actually mean +get+. This introduces security implications. This commit disallows calling +match+ without an HTTP verb constraint by default. To explicitly match all verbs, this commit also adds a :via => :all option to +match+. Closes #5964
* Revert "Merge pull request #5750 from ahoward/master"Santiago Pastorino2012-04-081-18/+0
| | | | | | | This reverts commit 174cf8b22064c3999dfa685014d5b31ac993bb54, reversing changes made to 7ecd6a731bd60665bc6de94095137f0b2c4ada2a. The reverted commit improved the performance in the wrong place, now we have added this 6ddbd1844a6fd6aca2992f5f75c9f605cf89808f improvement.
* Make url_for work when option is nil and default_url_options hasRafael Mendonça França2012-04-051-0/+9
| | | | stringified keys
* carefully and quickly merge url_for optionsara.t.howard2012-04-041-0/+9
|
* Add test for default_url_options[:port]Aaron Suggs2012-03-281-0/+12
|
* Fix url_for options[:subdomain] to allow objects as valueschoonkeat2011-12-141-0/+8
| | | | * e.g. blog_url(subdomain: current_user) instead of blog_url(subdomain: current_user.to_param)
* Fix trouble using :subdomain in development environment when using ↵Bradford Folkens2011-11-081-0/+11
| | | | | | | | | | | | | | | | numeric addresses. See-also pull request #3561 from 3-1-stable Otherwise the following occurs: TypeError: can't convert nil into String /Users/bfolkens/dev/bfolkens-rails-core/actionpack/lib/action_dispatch/http/url.rb:75:in host_or_subdomain_and_domain' /Users/bfolkens/dev/bfolkens-rails-core/actionpack/lib/action_dispatch/http/url.rb:37:in url_for' /Users/bfolkens/dev/bfolkens-rails-core/actionpack/lib/action_dispatch/routing/url_for.rb:147:in test_subdomain_may_be_accepted_with_numeric_host' /Users/bfolkens/dev/bfolkens-rails-core/activesupport/lib/active_support/testing/setup_and_teardown.rb:67:in run' /Users/bfolkens/dev/bfolkens-rails-core/activesupport/lib/active_support/callbacks.rb:426:in send' /Users/bfolkens/dev/bfolkens-rails-core/activesupport/lib/active_support/callbacks.rb:81:in run'
* :subdomain can now be specified with a value of false in url_for, allowing ↵Kamil Sobieraj2011-10-041-0/+14
| | | | for subdomain(s) removal from the host during link generation. Closes #2025
* expected message should come firstNeeraj Singh2011-06-111-2/+2
|
* Filter params that return nil for to_param and allow through false valuesAndrew White2011-03-091-0/+8
|
* Protocol-relative URL support.Stephen Celis2011-02-021-1/+14
| | | | | | [#5774 state:committed] Signed-off-by: Santiago Pastorino <santiago@wyeworks.com>
* :subdomain, :domain and :tld_length options can now be used in url_for, ↵Josh Kalderimis2010-11-231-1/+22
| | | | | | allowing for easy manipulation of the host during link generation. Signed-off-by: José Valim <jose.valim@gmail.com>
* Use parentheses when using assert_match followed by a regexp to avoid warnings.Emilio Tagua2010-09-271-1/+1
|
* Fixed url_for testŁukasz Strzałkowski2010-09-051-1/+1
| | | | Added route which matches all: controller, action, id and format
* Removed deprecated RouteSet API, still many tests failPiotr Sarnacki2010-09-051-4/+4
|
* Unify routes naming by renaming router to routesPiotr Sarnacki2010-07-021-1/+1
| | | | Signed-off-by: José Valim <jose.valim@gmail.com>
* URL fragments should not have safe characters escaped. Ref: Appendix A, ↵Andrew White2010-06-251-3/+9
| | | | | | | | http://tools.ietf.org/rfc/rfc3986.txt [#4762 state:resolved] Signed-off-by: Jeremy Kemper <jeremy@bitsweat.net>
* Make ActionDispatch url_for use HWIA symbolize_keysSantiago Pastorino2010-04-221-3/+7
| | | | Signed-off-by: Jeremy Kemper <jeremy@bitsweat.net>