aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/test/controller/resources_test.rb
Commit message (Collapse)AuthorAgeFilesLines
* Turn on performance based copsDillon Welch2018-07-231-2/+2
| | | | | | | | | | | | | | | | Use attr_reader/attr_writer instead of methods method is 12% slower Use flat_map over map.flatten(1) flatten is 66% slower Use hash[]= instead of hash.merge! with single arguments merge! is 166% slower See https://github.com/rails/rails/pull/32337 for more conversation
* Enable `Layout/EmptyLinesAroundBlockBody` to reduce review cost in the futureRyuta Kamizono2018-07-121-1/+0
| | | | | | | We sometimes ask "✂️ extra blank lines" to a contributor in reviews like https://github.com/rails/rails/pull/33337#discussion_r201509738. It is preferable to deal automatically without depending on manpower.
* Enable `Layout/SpaceBeforeComma` rubocop rule, and fixed moreRyuta Kamizono2017-12-121-1/+1
| | | | Follow up of #31390.
* Fix RuboCop offensesKoichi ITO2017-08-161-10/+10
| | | | And enable `context_dependent` of Style/BracesAroundHashParameters cop.
* 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
|
* Privatize unneededly protected methods in Action Pack testsAkira Matsuda2016-12-231-1/+1
|
* Add more rubocop rules about whitespacesRafael Mendonça França2016-10-291-3/+3
|
* improve error message when include assertions failMichael Grosser2016-09-161-1/+1
| | | | | | 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 three new rubocop rulesRafael Mendonça França2016-08-161-32/+32
| | | | | | | | Style/SpaceBeforeBlockBraces Style/SpaceInsideBlockBraces Style/SpaceInsideHashLiteralBraces Fix all violations in the repository.
* adds missing comma in assert callXavier Noria2016-08-071-2/+2
|
* normalizes indentation and whitespace across the projectXavier Noria2016-08-061-15/+15
|
* remove redundant curlies from hash argumentsXavier Noria2016-08-061-2/+2
|
* modernizes hash syntax in actionpackXavier Noria2016-08-061-314/+314
|
* applies new string literal convention in actionpack/testXavier Noria2016-08-061-233/+233
| | | | | The current code base is not uniform. After some discussion, we have chosen to go with double quotes by default.
* More Action Pack `abstract_unit` cleanup (#25211)Jon Moss2016-05-311-1/+15
| | | | | - Remove dead classes / dead code - Move class definitions to where they are used, don't define in a shared space
* Merge pull request #21366 from amitsuroliya/remove_unused_variableRafael Mendonça França2015-08-251-12/+12
|\ | | | | Remove more unused block arguments
| * Remove more unused block arguments amitkumarsuroliya2015-08-251-12/+12
| |
* | Trim out unneeded controllers from AP test suiteAditya Kapoor2015-08-241-4/+4
|/
* test the verb method on the route, specificallyAaron Patterson2015-08-171-1/+1
|
* routes are always constructed with a hash for the conditionsAaron Patterson2015-08-171-1/+1
|
* Refactor route assertion methods in resources testeileencodes2015-08-081-50/+51
| | | | | | | | The tests and methods were hard to read with `options[:options]` all over the place. This refactoring makes the code easier to understand. The change came out of work for moving the underlying code of controller tests to integraiton tests.
* let the superclass build the request and responseAaron Patterson2015-07-081-4/+0
| | | | | We should leverage the request / response objects that the superclass has already allocated for us.
* Merge pull request #18665 from sgrif/sg-test-route-allSean Griffin2015-02-201-0/+22
|\ | | | | Allow `method: "all"` as a valid routing test option
| * Allow `method: "all"` as a valid routing test optionSean Griffin2015-01-231-0/+22
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This allows the test to mirror the production code, since `via: :all` is a valid option. The behavior in 4.1 did not actually test that it matched all verbs, but instead defaulted to testing for "GET". This implementation aims to better handle the intention of passing "all". What will actually be asserted doesn't quite match up with the generated route, since it appears to just not create a constraint on the method. However, I don't think that we can easily test the lack of that constraint. Testing each of the main 4 HTTP verbs seems to be a reasonably close approximation, which should be sufficient for our needs. Fixes #18511.
* | Use public Module#include, in favor of https://bugs.ruby-lang.org/issues/8846robertomiranda2015-01-311-2/+2
| | | | | | | | ref: https://github.com/rails/rails/pull/18763#issuecomment-72349769
* | Switch to kwargs in ActionController::TestCase and ActionDispatch::IntegrationKir Shatrov2015-01-291-2/+2
|/ | | | | | | | Non-kwargs requests are deprecated now. Guides are updated as well. `post url, nil, nil, { a: 'b' }` doesn't make sense. `post url, params: { y: x }, session: { a: 'b' }` would be an explicit way to do the same
* Use Hash#each_key instead of Hash#keys.eachErik Michaels-Ober2014-09-291-6/+6
| | | | | | Hash#keys.each allocates an array of keys; Hash#each_key iterates through the keys without allocating a new array. This is the reason why Hash#each_key exists.
* fixed-case when invalid action name has passedKuldeep Aggarwal2013-11-281-0/+3
|
* fixed typo `destory` => `destroy` [ci skip]Kuldeep Aggarwal2013-11-281-1/+1
|
* Missing or unneeded require extract_optionsAkira Matsuda2013-02-011-0/+1
|
* Extract common controllers to abstract_unitRafael Mendonça França2012-08-131-29/+0
|
* removes usage of Object#in? from the code base (the method remains defined ↵Xavier Noria2012-08-061-3/+3
| | | | | | | | | | | | | | | | | | | by Active Support) Selecting which key extensions to include in active_support/rails made apparent the systematic usage of Object#in? in the code base. After some discussion in https://github.com/rails/rails/commit/5ea6b0df9a36d033f21b52049426257a4637028d we decided to remove it and use plain Ruby, which seems enough for this particular idiom. In this commit the refactor has been made case by case. Sometimes include? is the natural alternative, others a simple || is the way you actually spell the condition in your head, others a case statement seems more appropriate. I have chosen the one I liked the most in each case.
* load active_support/core_ext/object/inclusion in active_support/railsXavier Noria2012-08-021-1/+0
|
* Raise Assertion instead of RoutingError for routing assertion failures.David Chelimsky2012-05-201-5/+5
| | | | | | | | | | | | | Before this change, assert_recognizes, assert_generates, and assert_routing raised ActionController::RoutingError when they failed to recognize the route. This commit changes them to raise Assertion instead. This aligns with convention for logical failures, and supports reporting tools that care about the difference between logical failures and errors e.g. the summary at the end of a test run. - Fixes #5899
* Remove default match without specified methodJose and Yehuda2012-04-241-2/+2
| | | | | | | | | | | | | | | | 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
* Add config.default_method_for_update to support PATCHDavid Lee2012-02-221-9/+16
| | | | | | | | | | | | | | | | PATCH is the correct HTML verb to map to the #update action. The semantics for PATCH allows for partial updates, whereas PUT requires a complete replacement. Changes: * adds config.default_method_for_update you can set to :patch * optionally use PATCH instead of PUT in resource routes and forms * adds the #patch verb to routes to detect PATCH requests * adds #patch? to Request * changes documentation and comments to indicate support for PATCH This change maintains complete backwards compatibility by keeping :put as the default for config.default_method_for_update.
* Remove rescue_action from compatibility module and testsCarlos Antonio da Silva2012-01-171-1/+0
|
* all routes can be stored in the Journey Routes objectAaron Patterson2011-09-121-1/+1
|
* Pull up a method we only use once.Aaron Patterson2011-09-081-5/+1
|
* Conditions must never be equalAaron Patterson2011-09-081-6/+1
|
* There is no need to be destructive with the passed-in options.thedarkone2011-07-281-0/+9
| | | | This fixes a bug that is caused by Resource/SingletonResource mangling resource options when using inline "multi"-resource declarations.
* Using Object#in? and Object#either? in various placesPrem Sichanugrist2011-04-111-3/+4
| | | | There're a lot of places in Rails source code which make a lot of sense to switching to Object#in? or Object#either? instead of using [].include?.
* Cleanup deprecation warnings in Action ControllerCarlos Antonio da Silva2010-09-061-30/+0
| | | | Signed-off-by: José Valim <jose.valim@gmail.com>
* Remove a few tests from old router that do not make sense with the new one.José Valim2010-09-051-51/+3
|
* This test is invalid for new routerŁukasz Strzałkowski2010-09-051-20/+0
|
* raise error on invalid HTTP methods or :head passed with :via in routesPiotr Sarnacki2010-09-051-1/+1
|
* Implemented resources :foos, :except => :all optionPiotr Sarnacki2010-09-051-3/+9
|
* Fixed almost all resources testsPiotr Sarnacki2010-09-051-159/+213
|