aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/test/controller/filters_test.rb
Commit message (Collapse)AuthorAgeFilesLines
* Enable `Layout/EmptyLinesAroundAccessModifier` copRyuta Kamizono2019-06-131-3/+0
| | | | | | | | | | | We sometimes say "✂️ newline after `private`" in a code review (e.g. https://github.com/rails/rails/pull/18546#discussion_r23188776, https://github.com/rails/rails/pull/34832#discussion_r244847195). Now `Layout/EmptyLinesAroundAccessModifier` cop have new enforced style `EnforcedStyle: only_before` (https://github.com/rubocop-hq/rubocop/pull/7059). That cop and enforced style will reduce the our code review cost.
* Enable `Lint/UselessAssignment` cop to avoid unused variable warnings (#34904)Ryuta Kamizono2019-01-091-1/+1
| | | | | | | | | | | | | | * Enable `Lint/UselessAssignment` cop to avoid unused variable warnings Since we've addressed the warning "assigned but unused variable" frequently. 370537de05092aeea552146b42042833212a1acc 3040446cece8e7a6d9e29219e636e13f180a1e03 5ed618e192e9788094bd92c51255dda1c4fd0eae 76ebafe594fc23abc3764acc7a3758ca473799e5 And also, I've found the unused args in c1b14ad which raises no warnings by the cop, it shows the value of the cop.
* Enable `Style/RedundantBegin` cop to avoid newly adding redundant begin blockRyuta Kamizono2018-12-211-8/+4
| | | | | | | | | | Currently we sometimes find a redundant begin block in code review (e.g. https://github.com/rails/rails/pull/33604#discussion_r209784205). I'd like to enable `Style/RedundantBegin` cop to avoid that, since rescue/else/ensure are allowed inside do/end blocks in Ruby 2.5 (https://bugs.ruby-lang.org/issues/12906), so we'd probably meets with that situation than before.
* More exercise `test_running_prepended_before_and_after_action`Ryuta Kamizono2018-12-191-1/+3
| | | | | Just testing that `after_action` is invoked before `prepend_after_action`.
* Replace `assert !` with `assert_not`Daniel Colson2018-04-191-1/+1
| | | | | This autocorrects the violations after adding a custom cop in 3305c78dcd.
* Use assert_predicate and assert_not_predicateDaniel Colson2018-01-251-1/+1
|
* 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
|
* Correct spellingBenjamin Fleischer2017-02-051-1/+1
| | | | | | | ``` go get -u github.com/client9/misspell/cmd/misspell misspell -w -error -source=text . ```
* Reduce string objects by using \ instead of + or << for concatenating stringsAkira Matsuda2017-01-121-1/+1
| | | | (I personally prefer writing one string in one line no matter how long it is, though)
* Privatize unneededly protected methods in Action Pack testsAkira Matsuda2016-12-231-4/+4
|
* Add more rubocop rules about whitespacesRafael Mendonça França2016-10-291-23/+23
|
* Remove deprecated methods related to controller filtersRafael Mendonça França2016-10-091-29/+1
| | | | | | | | | | `skip_action_callback`, `skip_filter`, `before_filter`, `prepend_before_filter`, `skip_before_filter`, `append_before_filter`, `around_filter` `prepend_around_filter`, `skip_around_filter`, `append_around_filter`, `after_filter`, `prepend_after_filter`, `skip_after_filter` and `append_after_filter`.
* Add three new rubocop rulesRafael Mendonça França2016-08-161-4/+4
| | | | | | | | Style/SpaceBeforeBlockBraces Style/SpaceInsideBlockBraces Style/SpaceInsideHashLiteralBraces Fix all violations in the repository.
* applies remaining conventions across the projectXavier Noria2016-08-061-2/+0
|
* normalizes indentation and whitespace across the projectXavier Noria2016-08-061-29/+29
|
* modernizes hash syntax in actionpackXavier Noria2016-08-061-46/+46
|
* applies new string literal convention in actionpack/testXavier Noria2016-08-061-63/+63
| | | | | The current code base is not uniform. After some discussion, we have chosen to go with double quotes by default.
* 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
|