aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/test/controller/helper_test.rb
Commit message (Collapse)AuthorAgeFilesLines
* Make actionpack frozen string friendlyKir Shatrov2017-07-241-1/+3
|
* 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
|
* Define path with __dir__bogdanvlviv2017-05-231-4/+4
| | | | | | ".. with __dir__ we can restore order in the Universe." - by @fxn Related to 5b8738c2df003a96f0e490c43559747618d10f5f
* improve error message when include assertions failMichael Grosser2016-09-161-12/+12
| | | | | | assert [1, 3].includes?(2) fails with unhelpful "Asserting failed" message assert_includes [1, 3], 2 fails with "Expected [1, 3] to include 2" which makes it easier to debug and more obvious what went wrong
* Add `Style/EmptyLines` in `.rubocop.yml` and remove extra empty linesRyuta Kamizono2016-08-071-1/+0
|
* modernizes hash syntax in actionpackXavier Noria2016-08-061-8/+8
|
* applies new string literal convention in actionpack/testXavier Noria2016-08-061-20/+20
| | | | | The current code base is not uniform. After some discussion, we have chosen to go with double quotes by default.
* Implement helpers proxy in controller instance levelRafael Mendonça França2016-05-051-0/+16
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | It is a common pattern in the Rails community that when people want to :xa use any kind of helper that is defined inside app/helpers they includes the helper module inside the controller like: module UserHelper def my_user_helper # ... end end class UsersController < ApplicationController include UserHelper def index render inline: my_user_helper end end This has problem because the helper can't access anything that is defined in the view level context class. Also all public methods of the helper become available in the controller what can lead to undesirable methods being routed and behaving as actions. Also if you helper depends on other helpers or even Action View helpers you need to include each one of these dependencies in your controller otherwise your helper is not going to work. We already have a helpers proxy at controller class level but that proxy doesn't have access to the instance variables defined in the controller. With this new instance level helper proxy users can reuse helpers in the controller without having to include the modules and with access to instance variables defined in the controller. class UsersController < ApplicationController def index render inline: helpers.my_user_helper end end
* deletes code commented out in 72160d9fTony Ta2015-12-151-10/+0
|
* Change AC::TestResponse to AD::TestResponsePrem Sichanugrist2015-07-141-1/+1
| | | | | ActionController::TestResponse was removed in d9fe10c and caused a test failure on Action View as its test case still refers to it.
* let the superclass build the request and responseAaron Patterson2015-07-081-14/+5
| | | | | We should leverage the request / response objects that the superclass has already allocated for us.
* Use public Module#include, in favor of https://bugs.ruby-lang.org/issues/8846robertomiranda2015-01-311-3/+3
| | | | ref: https://github.com/rails/rails/pull/18763#issuecomment-72349769
* give a better error message for misspelled helpersXavier Noria2014-10-251-0/+22
| | | | | | See comment in this patch for the rationale. References #16468
* pass app config to controller helper proxyTima Maslyuchenko2013-10-241-0/+6
| | | | | | | | | | | | | | | After this fix application config become available when calling helper outisde of view config/application.rb #... config.asset_host = 'http://mycdn.com' #... Somewhere else ActionController::Base.helpers.asset_path('fallback.png') # => http://mycdn.com/assets/fallback.png
* stop `to_s`ing method namesAkira Matsuda2012-06-061-16/+16
| | | | Module#methods are Symbols in Ruby >= 1.9
* Fix sorting of helpers from different pathsPiotr Sarnacki2012-05-281-0/+30
| | | | | | | | | | | | | | | | When more than one directory for helpers is provided to a controller, it should preserver the order of directories. Given 2 paths: MyController.helpers_paths = ["dir1/helpers", "dir2/helpers"] helpers from dir1 should be loaded first. Before this commit, all helpers were mixed and then sorted alphabetically, which essentially would require to rename helpers to get desired order. This is a problem especially for engines, where you would like to be able to predict accurately which engine helpers will load first. (closes #6496)
* Remove rescue_action from compatibility module and testsCarlos Antonio da Silva2012-01-171-7/+0
|
* Removing extra requires from the test. Already loaded in abstract_unit.Arun Agrawal2011-07-311-1/+0
|
* removed deprecated methods, and related tests, from ActionPackJosh Kalderimis2011-05-241-1/+1
|
* Cleanup deprecation warnings in Action ControllerCarlos Antonio da Silva2010-09-061-12/+1
| | | | Signed-off-by: José Valim <jose.valim@gmail.com>
* Ensure that inherited helper_methods are available after calling ↵Jesse Storimer2010-08-281-0/+31
| | | | | | clear_helpers [#5348 state:resolved] Signed-off-by: José Valim <jose.valim@gmail.com>
* Be sure to call helper :all just on direct children. (Tests by Jesse Storimer)José Valim2010-08-261-0/+12
|
* Deletes trailing whitespaces (over text files only find * -type f -exec sed ↵Santiago Pastorino2010-08-141-7/+7
| | | | 's/[ \t]*$//' -i {} \;)
* Fix setting helpers_path to a string or pathnameJeremy Kemper2010-07-071-3/+3
|
* edit pass: the names of Rails components have a space, ie, "Active Record", ↵Xavier Noria2010-06-141-1/+1
| | | | not "ActiveRecord"
* Bring helpers_dir deprecation back.José Valim2010-01-301-11/+10
|
* Fix t('.helper').José Valim2010-01-261-10/+11
|
* Add a deprecation for helpers_dir.José Valim2010-01-251-2/+13
|
* Fix failing tests after merge.José Valim2010-01-241-2/+2
|
* Reorganize autoloads:Carlhuda2009-12-021-1/+1
| | | | | | | | | | | | | | | | | | | | | * A new module (ActiveSupport::Autoload) is provide that extends autoloading with new behavior. * All autoloads in modules that have extended ActiveSupport::Autoload will be eagerly required in threadsafe environments * Autoloads can optionally leave off the path if the path is the same as full_constant_name.underscore * It is possible to specify that a group of autoloads live under an additional path. For instance, all of ActionDispatch's middlewares are ActionDispatch::MiddlewareName, but they live under "action_dispatch/middlewares/middleware_name" * It is possible to specify that a group of autoloads are all found at the same path. For instance, a number of exceptions might all be declared there. * One consequence of this is that testing-related constants are not autoloaded. To get the testing helpers for a given component, require "component_name/test_case". For instance, "action_controller/test_case". * test_help.rb, which is automatically required by a Rails application's test helper, requires the test_case.rb for all active components, so this change will not be disruptive in existing or new applications.
* Ruby 1.9: resolve constant lookup issuesJeremy Kemper2009-11-041-6/+6
|
* Move some of helper tests to AbstractController.José Valim2009-11-011-34/+0
|
* Cleaning up more tests and code that needed to work in both old and new baseYehuda Katz + Carl Lerche2009-06-171-16/+3
|
* Write documentation for AbstractController::HelpersYehuda Katz + Carl Lerche2009-06-091-3/+16
|
* ActionPack components should no longer have undeclared dependencies.Yehuda Katz + Carl Lerche2009-06-081-3/+3
| | | | | | | * Tests can be run in isolation * Dependencies added * A few tests modified to avoid depending on AS deps not depended on my files they were testing
* Add all the existing helpers related features to the new basePratik Naik2009-05-231-3/+3
|
* Rescue hack was supposed to be removed. Some how it crept back in.Joshua Peek2009-05-171-3/+0
|
* Cherry-pick core extensionsJeremy Kemper2009-05-131-0/+1
|
* Implement FooController.action(:name)Yehuda Katz2009-05-021-12/+28
| | | | | | * Rails actions are now Rack endpoints, and can be retrieved via FooController.action(name) and called with an env * Updated some tests that relied on the old internal #process/#call implementation
* Refactor ActionView::TemplateYehuda Katz + Carl Lerche2009-04-271-1/+1
| | | | | | | | ActionView::Template is now completely independent from template storage, which allows different back ends such as the database. ActionView::Template's only responsibility is to take in the template source (passed in from ActionView::Path), compile it, and render it.
* Allow helpers directory to be overridden via ↵Sam Pohlenz2008-11-231-1/+15
| | | | | | ActionController::Base.helpers_dir (Sam Pohlenz) [#1424 state:committed] Signed-off-by: David Heinemeier Hansson <david@loudthinking.com>
* Ruby 1.9 compat: qualify module name within module_evaled blockJeremy Kemper2008-05-191-1/+1
|
* Provide a helper proxy to access helper methods from outside views. Closes ↵Josh Peek2008-04-061-0/+16
| | | | | | #10839 [Josh Peek] git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@9234 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
* Remove unused ActionController::Base.template_class. Closes #10787Pratik Naik2008-03-051-13/+1
| | | | git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@8985 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
* require abstract_unit directly since test is in load pathJeremy Kemper2008-01-051-1/+1
| | | | git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@8564 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
* Ruby 1.9 compat: helpersJeremy Kemper2007-12-151-6/+8
| | | | git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@8409 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
* Added helper(:all) as a way to include all helpers from app/helpers/**/*.rb ↵David Heinemeier Hansson2007-02-241-2/+19
| | | | | | in ApplicationController [DHH] git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@6221 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
* r4487@asus: jeremy | 2006-04-29 12:21:39 -0700Jeremy Kemper2006-07-081-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Check whether @flash is defined? for warnings-safety. r4488@asus: jeremy | 2006-04-29 12:23:15 -0700 Check whether @flash is defined? for warnings-safety. Obviates nil? check. r4489@asus: jeremy | 2006-04-29 12:45:18 -0700 Check whether @session is defined? for warnings-safety. r4490@asus: jeremy | 2006-04-29 12:50:41 -0700 Check whether @rendering_runtime is defined? for warnings-safety. r4491@asus: jeremy | 2006-04-29 12:55:01 -0700 Check whether @_cycles is defined? for warnings-safety. r4492@asus: jeremy | 2006-04-29 12:59:19 -0700 Check whether instance variables are defined? for warnings-safety. r4493@asus: jeremy | 2006-04-29 13:14:09 -0700 Add nil @template to PrototypeHelperTest to suppress unitialized instance variable warning. r4494@asus: jeremy | 2006-04-29 13:31:34 -0700 Check whether @auto_index defined? for warnings-safety. r4495@asus: jeremy | 2006-04-29 13:32:24 -0700 Wrap content_columns redefinitions with silence_warnings. r4496@asus: jeremy | 2006-04-29 13:35:28 -0700 Wrap more redefinitions with silence_warnings. r4829@asus: jeremy | 2006-07-08 10:59:20 -0700 abstract unit, fix warnings r4830@asus: jeremy | 2006-07-08 11:06:12 -0700 Use parens to silence warning. r4831@asus: jeremy | 2006-07-08 11:06:48 -0700 Use parens to silence warning. git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@4595 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
* Controllers with acronyms in their names (e.g. PDFController) require the ↵Jeremy Kemper2005-11-081-5/+21
| | | | | | correct default helper (PDFHelper in file pdf_helper.rb). Closes #2262. Do not raise an exception when default helper is missing; log a debug message instead. It's nice to delete empty helpers. git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@2938 5ecf4fe2-1ee6-0310-87b1-e25e094e27de