aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/test/controller/filters_test.rb
Commit message (Collapse)AuthorAgeFilesLines
* Stop using deprecated `render :text` in testPrem Sichanugrist2015-07-171-13/+13
| | | | | | | | | This will silence deprecation warnings. Most of the test can be changed from `render :text` to render `:plain` or `render :body` right away. However, there are some tests that needed to be fixed by hand as they actually assert the default Content-Type returned from `render :body`.
* only call methods that are on the superclassAaron Patterson2015-07-141-1/+1
| | | | | | We want to treat the response object as if it's a real response object (not a test object), so we should only call methods that are on the superclass.
* let the superclass build the request and responseAaron Patterson2015-07-081-5/+2
| | | | | We should leverage the request / response objects that the superclass has already allocated for us.
* Remove `assigns` and `assert_template`.Guo Xiang Tan2015-05-301-80/+71
|
* fix NameError in `skip_filter`. callback doesn't exist.yuuji.yaginuma2015-02-271-0/+8
|
* Use other controller instead of sharing the controllerRafael Mendonça França2015-02-241-18/+17
|
* Make TestController available to all test classesRafael Mendonça França2015-02-241-16/+16
|
* Deprecate `AbstractController::Callbacks#skip_action_callback`Iain Beeston2015-02-241-2/+22
| | | | | | | | | | As part of #19029, in future `skip_before_action`, `skip_after_action` and `skip_around_action` will raise an ArgumentError if the specified callback does not exist. `skip_action_callback` calls all three of these methods and will almost certainly result in an ArgumentError. If anyone wants to remove all three callbacks then they can still call the three individual methods. Therefore let's deprecate `skip_action_callback` now and remove it when #19029 is merged.
* Add test/doc for :if/:except in skip_before_actionclaudiob2015-01-081-2/+19
| | | | | | | | | | | | | | | | | | | | | | | The new test/docs further explain the conflicts that can happen when mixing `:if`/`:unless` options with `:only`/`:except` options in `skip_before_action`. The gist is that "positive" filters always have priority over negative ones. The previous commit already showed that `:only` has priority over `:if`. This commit shows that `:if` has priority over `:except`. For instance, the following snippets are equivalent: ```ruby skip_before_action :some_callback, if: -> { condition }, except: action ``` ```ruby skip_before_action :some_callback, if: -> { condition } ```
* Add test case and documentation for skip_before_filter.Lauro Caetano2015-01-081-0/+17
| | | | | | | | Test case for using skip_before_filter with the options :only and :if both present. In this case, the :if option will be ignored and :only will be executed. Closes #14549 (the commit was cherry-picked from there).
* Remove single space response body for head requestPrathamesh Sonpatki2014-12-301-3/+3
| | | | | | | | | | | | | | - The single space response was added due to a bug in safari in https://github.com/rails/rails/commit/cb0f8fda9652c4d24d04693bdb82cecd3b067e5c and https://github.com/rails/rails/commit/807df4fcf021fc4d15972aa1c17ba7398d43ab0d. - This was removed from the `render nothing: true` in https://github.com/rails/rails/pull/14883. - Removing it from response of :head also. As :head is more obvious alternative to call `render nothing: true`(http://guides.rubyonrails.org/layouts_and_rendering.html#using-head-to-build-header-only-responses), removing it from head method also. - Closes #18253.
* Remove misleading test: around_action return falseclaudiob2014-12-151-19/+1
| | | | | | | | | | | | | | | | | | | | When an `around_action` does not `yield`, then the corresponding action is *never* executed and the `after_` actions are *never* invoked. The value returned by the `around_action` does not have any impact on this: an `around_action` can "return" `true`, `false`, or `"pizza"`, but as long as `yield` is not invoked, the corresponding action and after callbacks are not executed. The test suite for `ActionController::Callbacks` currently includes separate tests to distinguish the cases in which a non-yielding `around_actions` returns `true` or `false`. In my opinion, having such tests is misleading, giving the impression that the returned value might have some sort of impact, while it does not. At least that's the impression I got when I read those tests. For completeness, the tests were introduced 7 years ago by @NZKoz in e80fabb.
* Pass symbol as an argument instead of a blockErik Michaels-Ober2014-11-291-1/+1
|
* Deprecate all *_filter callbacks in favor of *_action callbacksRafael Mendonça França2014-05-271-190/+190
| | | | | This is the continuation of the work started at 9d62e04838f01f5589fa50b0baa480d60c815e2c
* Tests that skips a controller filters that was set up using a classIonatan Wiznia2014-02-061-0/+16
|
* Unused classes in AP testsAkira Matsuda2013-12-251-11/+0
|
* Revert "Port all remaining self.protected_instance_variables to class methods"Łukasz Strzałkowski2013-09-021-1/+1
| | | | This reverts commit 7de994fa215e9f4c2856d85034bc4dd7b65d0c01.
* Port all remaining self.protected_instance_variables to class methodsŁukasz Strzałkowski2013-08-291-1/+1
|
* Execute conditional procs on controller filters only for current action.Nicholas Jakobsen2013-08-101-0/+9
| | | | | | :only and :except options for controller filters are now added before :if and :unless. This prevents running :if and :unless procs when not on the specified. Closes #11786.
* Merge pull request #10591 from acapilleri/cond_callback_testAaron Patterson2013-05-151-0/+13
|\ | | | | add test for skip_before_filter with condition
| * add test for skip_before_filter with conditionAngelo capilleri2013-05-131-0/+13
| |
* | use public api for testing rather than grabbing instance variablesAaron Patterson2013-05-141-1/+1
|/
* Remove unnecessary begin..rescue..end, use only rescueAkira Matsuda2013-01-061-5/+3
|
* Remove observers and sweepersRafael Mendonça França2012-11-281-41/+0
| | | | | | | | They was extracted from a plugin. See https://github.com/rails/rails-observers [Rafael Mendonça França + Steve Klabnik]
* AS::Callbacks: deprecate monkey patch of object callbacksBogdan Gusiev2012-09-071-7/+7
|
* Clean up Sweeper controller accessor when an Error is raisedBrian John2012-07-201-0/+11
|
* AS::Callbacks: deprecate monkey patch codeBogdan Gusiev2012-06-261-0/+12
| | | | | Deprecate usage of filter object with #before and #after methods as around callback
* prevent the cache sweeper ignores NoMethodErrorayaya2012-03-291-0/+7
|
* Remove unused global variable in controller filters testAlexey Vakhov2012-02-231-2/+0
|
* Move render_to_body logic to return a spaced string to AC::RenderingCarlos Antonio da Silva2012-01-171-2/+0
| | | | | | | | | | | This seems to be required only when calling render :partial with an empty collection from a controller. This call happens to return no content, letting the response body empty, which means to Rails that it should go on and try to find a template to render based on the current action name, thus failing hard. Although tests keep all green, we need to check a better way to fix this.
* Remove rescue_action from compatibility module and testsCarlos Antonio da Silva2012-01-171-12/+0
|
* get rid of using instance_variable_names method from ASSergey Nartimov2012-01-071-1/+1
| | | | | - instance_variables return symbols in 1.9 - there is instance_variable_defined? method
* Tests only after filters in cache sweepersJeroen Jacobs2011-06-221-0/+5
|
* Fix filter :only and :except with implicit actionsAndrew White2011-03-231-11/+16
| | | | | | | The method_name argument is "default_render" for implicit actions so use the action_name attribute to determine which callbacks to run. [#5673 state:resolved]
* Add a failing test case for an implicit action with a before filter.Manfred Stienstra2011-03-231-0/+22
| | | | Signed-off-by: Andrew White <andyw@pixeltrix.co.uk>
* cleaning up some warnings on 1.9.3Aaron Patterson2011-02-071-5/+5
|
* Make after_filter halt when before_filter renders or redirects [#5648 ↵Marcelo Giorgi2010-11-111-2/+79
| | | | | | state:resolved] Signed-off-by: José Valim <jose.valim@gmail.com>
* fixing a few test warningsAaron Patterson2010-10-041-2/+2
|
* We can't assign @view_context_class here, define super() in test instead if ↵Emilio Tagua2010-09-291-0/+1
| | | | we want to avoid warnings.
* Remove more warnings on AP.Emilio Tagua2010-09-281-1/+1
|
* Remove deprecated stuff in ActionControllerCarlos Antonio da Silva2010-09-261-1/+2
| | | | | | This removes all deprecated classes in ActionController related to Routing, Abstract Request/Response and Integration/IntegrationTest. All tests and docs were changed to ActionDispatch instead of ActionController.
* Deletes trailing whitespaces (over text files only find * -type f -exec sed ↵Santiago Pastorino2010-08-141-1/+1
| | | | 's/[ \t]*$//' -i {} \;)
* Better test for ticket [#3914 state:resolved]Neeraj Singh2010-06-091-0/+11
| | | | Signed-off-by: José Valim <jose.valim@gmail.com>
* cache_sweeper yields blank outputNeeraj Singh2010-06-081-0/+6
| | | | | | [#3914 state:open] Signed-off-by: José Valim <jose.valim@gmail.com>
* Use better assertion methods for testingNeeraj Singh2010-05-191-7/+7
| | | | | | [#4645 state:resolved] Signed-off-by: José Valim <jose.valim@gmail.com>
* Modify assert_template to use notifications. Also, remove ↵Carlhuda2010-03-171-2/+2
| | | | ActionController::Base#template since it is no longer needed.
* deOMGifying Railties, Active Support, and Action PackMikel Lindsaar2010-01-311-3/+3
|
* Symbol#to_proc is not needed for Ruby >= 1.8.7Xavier Noria2009-11-091-1/+0
|
* Cleaning up more tests and code that needed to work in both old and new baseYehuda Katz + Carl Lerche2009-06-171-50/+18
|
* YAGNI Method references. DeprecatedYehuda Katz2009-06-021-4/+6
|