aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/test/controller/parameters
Commit message (Collapse)AuthorAgeFilesLines
* Remove usage of strip_heredoc in the framework in favor of <<~Rafael Mendonça França2018-02-161-3/+2
| | | | | Some places we can't remove because Ruby still don't have a method equivalent to strip_heredoc to be called in an already existent string.
* Use assert_empty and assert_not_emptyDaniel Colson2018-01-252-3/+3
|
* Use assert_predicate and assert_not_predicateDaniel Colson2018-01-258-69/+69
|
* Change refute to assert_notDaniel Colson2018-01-252-9/+9
|
* Use respond_to test helpersDaniel Colson2018-01-251-1/+1
|
* Suppress `warning: BigDecimal.new is deprecated`Yasuo Honda2017-12-151-1/+1
| | | | | | | | | | | | | | | | | | | | `BigDecimal.new` has been deprecated in BigDecimal 1.3.3 which will be a default for Ruby 2.5. Refer https://github.com/ruby/bigdecimal/commit/533737338db915b00dc7168c3602e4b462b23503 * This commit has been made as follows: ``` cd rails git grep -l BigDecimal.new | grep -v guides/source/5_0_release_notes.md | grep -v activesupport/test/xml_mini_test.rb | xargs sed -i -e "s/BigDecimal.new/BigDecimal/g" ``` - `activesupport/test/xml_mini_test.rb` Editmanually to remove `.new` and `::` - guides/source/5_0_release_notes.md This is a Rails 5.0 release notes.
* Yield array from AC::Parameters#each for block with one argDominic Cleal2017-12-061-0/+16
| | | | Matches Hash#each behaviour as used in Rails 4.
* Use frozen string literal in actionpack/Kir Shatrov2017-07-2910-0/+20
|
* Revert "Merge pull request #29540 from kirs/rubocop-frozen-string"Matthew Draper2017-07-0210-10/+0
| | | | | This reverts commit 3420a14590c0e6915d8b6c242887f74adb4120f9, reversing changes made to afb66a5a598ce4ac74ad84b125a5abf046dcf5aa.
* Merge pull request #29540 from kirs/rubocop-frozen-stringMatthew Draper2017-07-0210-0/+10
|\ | | | | | | Enforce frozen string in Rubocop
| * Enforce frozen string in RubocopKir Shatrov2017-07-0110-0/+10
| |
* | Fallback Parameters#to_s to Hash#to_sKir Shatrov2017-06-301-0/+5
|/ | | Fixes https://github.com/rails/rails/issues/29617
* prepare for Minitest 6utilum2017-06-201-1/+1
|
* Pass block in ActionController::Parameters#deleteEugene Kenny2017-05-101-0/+21
| | | | | | | | In order to fully support the same interface as `Hash#delete`, we need to pass the block through to the underlying method, not just the key. This used to work correctly, but it regressed when `ActionController::Parameters` stopped inheriting from `Hash` in 5.0.
* Add test case to make sure we can implicit convert a Parameters to a HashRafael Mendonça França2017-04-201-0/+7
|
* Use the right assetions to better error messagesRafael Mendonça França2017-04-181-7/+7
|
* Add test to make sure that to_unsafe_h don't mutate the targetRafael Mendonça França2017-04-181-0/+10
|
* Add ActionController::Parameters#to_hash to implict conversionRafael Mendonça França2017-04-181-0/+26
| | | | | | | | Now methods that implicit convert objects to a hash will be able to work without requiring the users to change their implementation. This method will return a Hash instead of a HashWithIndefirentAccess to mimic the same implementation of HashWithIndefirentAccess#to_hash.
* Raise exception when calling to_h in a unfiltered ParametersRafael Mendonça França2017-04-181-15/+4
| | | | | | | | | | | | | | | | Before we returned either an empty hash or only the always permitted parameters (:controller and :action by default). The previous behavior was dangerous because in order to get the attributes users usually fallback to use to_unsafe_h that could potentially introduce security issues. The to_unsafe_h API is also not good since Parameters is a object that quacks like a Hash but not in all cases since to_h would return an empty hash and users were forced to check if to_unsafe_h is defined or if the instance is a ActionController::Parameters in order to work with it. This end up coupling a lot of libraries and parts of the application with something that is from the controller layer.
* Test the correct objectRafael Mendonça França2017-04-181-1/+1
|
* Add aliases for reverse_merge to with_defaultsMatt Casper2017-03-291-0/+16
| | | | | | In the context of controller parameters, reverse_merge is commonly used to provide defaults for user input. Having an alias to reverse_merge called with_defaults feels more idiomatic for Rails.
* Fix test that was asserting the wrong thingRafael Mendonça França2017-03-211-1/+1
|
* Use correct value in `reverse_merge` testyuuji.yaginuma2017-03-111-8/+4
|
* Added `reverse_merge`/`reverse_merge!` to AC::Parameters:Edouard CHIN2017-03-091-0/+29
| | | | | - This PR adds the `reverse_merge` and `reverse_merge!` method to `ActionController::Parameters` - Fixes #28353
* Tests for delegated public methods on AC::ParametersT.J. Schuck2017-03-071-0/+63
|
* :warning: "Use assert_nil if expecting nil. This will fail in MT6."Akira Matsuda2017-01-181-2/+10
| | | | | | These are followups for 307065f959f2b34bdad16487bae906eb3bfeaf28, but TBH I'm personally not very much confortable with this style. Maybe we could override assert_equal in our test_helper not to warn?
* Fix all rubocop violationsRafael Mendonça França2017-01-171-1/+1
|
* Added test to ensure that we dont break #to_h again when trying to restore ↵David Heinemeier Hansson2017-01-161-0/+5
| | | | the speed-up from 26dd9b26ab7317f94fd285245879e888344143b2 (cc: @fxn)
* Revert "significant speedup of AC::Parameters#permit" ↵David Heinemeier Hansson2017-01-161-5/+0
| | | | [26dd9b26ab7317f94fd285245879e888344143b2] as it broke Parameters#to_h on at least fields_for-style nested params.
* "Use assert_nil if expecting nil. This will fail in minitest 6."Akira Matsuda2016-12-251-4/+4
|
* Fix style violationsRafael Mendonça França2016-11-141-1/+1
|
* significant speedup of AC::Parameters#permitXavier Noria2016-11-121-0/+5
| | | | | | | | | | | | | | | | | | | | | The current implementation of AC::Parameters#permit builds permitted hashes and then calls permit! on them. This filtering is recursive, so we call permit! on terminal branches, but then ascendants call permit! on themselves when the recursion goes up the stack, which recurses all the way down again because permit! is recursive itself. Repeat this for every parent node and you get some scary O-something going on that I don't even want to compute. Instead, since the whole point of the permit recursion is to build permitted hashes along the way and at that point you know you've just come up with a valid filtered version, you can already switch the toggle on the spot. I have seen 2x speedups in casual benchmarks with small structures. As the previous description shows, the difference in performance is going to be a function of the nesting. Note that that the involved methods are private and used only by permit.
* adds support for arbitrary hashes in strong parametersXavier Noria2016-11-111-0/+33
|
* Merge pull request #26820 from y-yagi/add_bang_merge_to_parametersRafael França2016-11-101-0/+17
|\ | | | | add `ActionController::Parameters#merge!`
| * add `ActionController::Parameters#merge!`yuuji.yaginuma2016-10-181-0/+17
| | | | | | | | | | This method has the same behavior as `Hash#merge!`, returns current `ActionController::Parameters`.
* | Add more rubocop rules about whitespacesRafael Mendonça França2016-10-292-7/+7
| |
* | Soften this test since YAML.dump may produce keys in other orders.Charles Oliver Nutter2016-10-211-6/+4
|/
* ActionController::Parameters#deep_dup (#26567)Pavel Evstigneev2016-10-111-0/+22
| | | | | | | | | | | * ActionController::Parameters#deep_dup * Tests for ActionController::Parameters#deep_dup * Fix test for ActionController::Parameters#deep_dup * More tests for ActionController::Parameters#deep_dup [Rafael Mendonça França + Pavel Evstigneev]
* Remove deprecated comparing support with `ActionController::Parameters`Rafael Mendonça França2016-10-101-8/+0
|
* call `.to_h` to avoid using deprecated methodyuuji.yaginuma2016-09-071-0/+7
| | | | | | | | | | | `ActionController::Parameters#merge` call `HashWithIndifferentAccess#merge`. In addition, it calls `HashWithIndifferentAccess#update` from `HashWithIndifferentAccess#merge`, where it is called the `#to_hash` of argument. But `ActionController::Parameters#to_hash` is deprecated, warning message is displayed. To avoid this, modify to convert object to `Hash`. Fixes #26415
* Merge pull request #26094 from igorkasyanchuk/masterRafael França2016-08-161-4/+4
|\ | | | | Show unpermitted parameters as symbols in logs (so they could be copy…
| * Show unpermitted parameters as symbols in logs (so they could be copy-pasted ↵Igor Kasyanchuk2016-08-101-4/+4
| | | | | | | | to the code)
* | Add three new rubocop rulesRafael Mendonça França2016-08-165-14/+14
| | | | | | | | | | | | | | | | Style/SpaceBeforeBlockBraces Style/SpaceInsideBlockBraces Style/SpaceInsideHashLiteralBraces Fix all violations in the repository.
* | Fix broken alignments caused by auto-correct commit 411ccbdRyuta Kamizono2016-08-105-18/+36
|/ | | | Hash syntax auto-correcting breaks alignments. 411ccbdab2608c62aabdb320d52cb02d446bb39c
* applies remaining conventions across the projectXavier Noria2016-08-061-1/+1
|
* normalizes indentation and whitespace across the projectXavier Noria2016-08-061-11/+11
|
* remove redundant curlies from hash argumentsXavier Noria2016-08-066-71/+35
|
* modernizes hash syntax in actionpackXavier Noria2016-08-061-6/+6
|
* applies new string literal convention in actionpack/testXavier Noria2016-08-0610-111/+111
| | | | | The current code base is not uniform. After some discussion, we have chosen to go with double quotes by default.
* Fix wrong assignment.Kasper Timm Hansen2016-08-021-4/+5
| | | | Screwed up both the left and right hand sides!