aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/test/journey
Commit message (Collapse)AuthorAgeFilesLines
* Enable `Performance/UnfreezeString` copyuuji.yaginuma2018-09-231-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | In Ruby 2.3 or later, `String#+@` is available and `+@` is faster than `dup`. ```ruby # frozen_string_literal: true require "bundler/inline" gemfile(true) do source "https://rubygems.org" gem "benchmark-ips" end Benchmark.ips do |x| x.report('+@') { +"" } x.report('dup') { "".dup } x.compare! end ``` ``` $ ruby -v benchmark.rb ruby 2.5.1p57 (2018-03-29 revision 63029) [x86_64-linux] Warming up -------------------------------------- +@ 282.289k i/100ms dup 187.638k i/100ms Calculating ------------------------------------- +@ 6.775M (± 3.6%) i/s - 33.875M in 5.006253s dup 3.320M (± 2.2%) i/s - 16.700M in 5.032125s Comparison: +@: 6775299.3 i/s dup: 3320400.7 i/s - 2.04x slower ```
* Add test case for the `|` token in Journey scannervaidehijoshi2018-06-181-0/+6
| | | | | | | Journey's scanner tokenizes the `|` (:OR) operator when scanning route urls such as `"/:foo|*bar"`. However, the current scanner test does not have any test cases for the `|` operator. This commit adds a test case for this particular token.
* Fix bug with eager_load in development environmentDan Jensen2018-06-111-0/+9
| | | | | Modifies the routes simulator to allow for empty RouteSets, which are created when secondary Engines are loaded.
* Break up Journey's scanner testvaidehijoshi2018-04-241-47/+50
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This breaks up the one megatest for Journey's scanner into multiple test cases, which also provides better output when there is a failure in the scanner. Before: ``` ./bin/test test/journey/route/definition/scanner_test.rb Run options: --seed 778 F Failure: ActionDispatch::Journey::Definition::TestScanner#test_tokens [/Users/vaidehijoshi/Code/tilde/rails/actionpack/test/journey/route/definition/scanner_test.rb:57]: --- expected +++ actual @@ -1 +1 @@ -[[:SLASH, "/"], [:LITERAL, "page!!"]] +[[:SLASH, "/"], [:LITERAL, "page!"]] bin/test Users/vaidehijoshi/Code/tilde/rails/actionpack/test/journey/route/definition/scanner_test.rb:14 Finished in 0.090899s, 11.0012 runs/s, 44.0049 assertions/s. 1 runs, 4 assertions, 1 failures, 0 errors, 0 skips ``` After: ``` ./bin/test test/journey/route/definition/scanner_test.rb Run options: --seed 2230 ....................F Failure: ActionDispatch::Journey::Definition::TestScanner#test_scanning_/page$ [/Users/vaidehijoshi/Code/tilde/rails/actionpack/test/journey/route/definition/scanner_test.rb:58]: Wrong tokens for `/page$`. --- expected +++ actual @@ -1 +1 @@ -[[:SLASH, "/"], [:LITERAL, "page$$"]] +[[:SLASH, "/"], [:LITERAL, "page$"]] bin/test Users/vaidehijoshi/Code/tilde/rails/actionpack/test/journey/route/definition/scanner_test.rb:56 F Failure: ActionDispatch::Journey::Definition::TestScanner#test_scanning_/page! [/Users/vaidehijoshi/Code/tilde/rails/actionpack/test/journey/route/definition/scanner_test.rb:58]: Wrong tokens for `/page!`. --- expected +++ actual @@ -1 +1 @@ -[[:SLASH, "/"], [:LITERAL, "page!!"]] +[[:SLASH, "/"], [:LITERAL, "page!"]] bin/test Users/vaidehijoshi/Code/tilde/rails/actionpack/test/journey/route/definition/scanner_test.rb:56 F Failure: ActionDispatch::Journey::Definition::TestScanner#test_scanning_/page& [/Users/vaidehijoshi/Code/tilde/rails/actionpack/test/journey/route/definition/scanner_test.rb:58]: Wrong tokens for `/page&`. --- expected +++ actual @@ -1 +1 @@ -[[:SLASH, "/"], [:LITERAL, "page&&"]] +[[:SLASH, "/"], [:LITERAL, "page&"]] bin/test Users/vaidehijoshi/Code/tilde/rails/actionpack/test/journey/route/definition/scanner_test.rb:56 Finished in 0.126447s, 181.8944 runs/s, 181.8944 assertions/s. 23 runs, 23 assertions, 3 failures, 0 errors, 0 skips ```
* Use assert_empty and assert_not_emptyDaniel Colson2018-01-251-3/+3
|
* Use assert_predicate and assert_not_predicateDaniel Colson2018-01-252-3/+3
|
* Enable `Layout/LeadingCommentSpace` to not allow cosmetic changes in the futureRyuta Kamizono2017-12-141-1/+1
| | | | Follow up of #31432.
* Fix RuboCop offensesKoichi ITO2017-08-161-5/+5
| | | | And enable `context_dependent` of Style/BracesAroundHashParameters cop.
* Use File::NULL instead of "/dev/null"Kazuhiro NISHIYAMA2017-07-311-1/+1
|
* Use frozen string literal in actionpack/Kir Shatrov2017-07-2912-1/+23
|
* normalize_path used to be nil tolerantAkira Matsuda2017-07-121-0/+4
| | | | fixes a regression introduced at 8607c25ba7810573733d9b37d0015154ba059f5e
* [Action Pack] `rubocop -a --only Layout/EmptyLineAfterMagicComment`Koichi ITO2017-07-111-0/+1
|
* Prepare AP and AR to be frozen string friendlyKir Shatrov2017-07-061-1/+2
|
* Revert "Merge pull request #29540 from kirs/rubocop-frozen-string"Matthew Draper2017-07-0212-12/+0
| | | | | This reverts commit 3420a14590c0e6915d8b6c242887f74adb4120f9, reversing changes made to afb66a5a598ce4ac74ad84b125a5abf046dcf5aa.
* Enforce frozen string in RubocopKir Shatrov2017-07-0112-0/+12
|
* Remove unused simulate methodeileencodes2017-05-221-13/+21
| | | | | | This method was only used in the Rails tests and not by other methods in the Rails simulator. Because it's a no-doc'd class it should be safe to remove without deprecation.
* Maintain original encoding from patheileencodes2017-05-121-0/+5
| | | | | | | | | When the path info is read from the socket it's encoded as ASCII 8BIT. The unescape method changes the encoding to UTF8 but it should maintain the encoding of the string that's passed in. This causes parameters to be force encoded to UTF8 when we don't actually know what the encoding of the parameter should be.
* Properly escape test namesAkira Matsuda2017-02-021-3/+3
| | | | since the test names become Regexp filters, non-escaped test names cause RegexpError on isolated test via bin/test
* Optimize Journey::Route#scoreBen Hughes2016-12-281-1/+1
| | | | | | | | Scoring routes based on constraints repeated many type conversions that could be performed in the outer loop. Determinations of score and fitness also used Array operations that required allocations. Against my benchmark with a large routeset, this reduced object allocations by over 30x and wall time by over 3x.
* Add more rubocop rules about whitespacesRafael Mendonça França2016-10-297-22/+22
|
* Show an "unmatched constraints" error for mismatching and present paramsChris Carter2016-10-031-1/+1
| | | | | | | | | | | | Currently a misleading "missing required keys" error is thrown when a param fails to match the constraints of a particular route. This commit ensures that these params are recognised as unmatching rather than missing. Note: this means that a different error message will be provided between optimized and non-optimized path helpers, due to the fact that the former does not check constraints when matching routes. Fixes #26470.
* Add three new rubocop rulesRafael Mendonça França2016-08-165-26/+26
| | | | | | | | Style/SpaceBeforeBlockBraces Style/SpaceInsideBlockBraces Style/SpaceInsideHashLiteralBraces Fix all violations in the repository.
* Fix broken alignments caused by auto-correct commit 411ccbdRyuta Kamizono2016-08-101-2/+4
| | | | Hash syntax auto-correcting breaks alignments. 411ccbdab2608c62aabdb320d52cb02d446bb39c
* applies remaining conventions across the projectXavier Noria2016-08-067-13/+13
|
* normalizes indentation and whitespace across the projectXavier Noria2016-08-064-65/+65
|
* remove redundant curlies from hash argumentsXavier Noria2016-08-062-25/+21
|
* modernizes hash syntax in actionpackXavier Noria2016-08-063-79/+79
|
* applies new string literal convention in actionpack/testXavier Noria2016-08-0612-354/+354
| | | | | The current code base is not uniform. After some discussion, we have chosen to go with double quotes by default.
* Deprecate :controller and :action path parametersAndrew White2016-03-011-61/+69
| | | | | | | | Allowing :controller and :action values to be specified via the path in config/routes.rb has been an underlying cause of a number of issues in Rails that have resulted in security releases. In light of this it's better that controllers and actions are explicitly whitelisted rather than trying to blacklist or sanitize 'bad' values.
* Remove TestRouter#add_routesakihiro172015-09-291-11/+0
| | | | | | Now, we use the mapper to build the routing table related to https://github.com/rails/rails/commit/703275ba70efbefb3358052b6ba750443eff1a28
* File encoding is defaulted to utf-8 in Ruby >= 2.1Akira Matsuda2015-09-181-1/+0
|
* symbols will always be constructed with strings. :bomb:Aaron Patterson2015-08-181-1/+1
|
* routes are always constructed with a hash for the conditionsAaron Patterson2015-08-171-1/+1
|
* introduce an alternate constructor for Route objectsAaron Patterson2015-08-171-12/+12
| | | | | I want to change the real constructor to take a particular parameter for matching the request method
* default pattern to use a joined stringAaron Patterson2015-08-172-13/+15
| | | | | The string we create is almost always the same, so rather than joining all the time, lets join once, then reuse that string everywhere.
* use the mapper to build the routing tableAaron Patterson2015-08-152-231/+103
| | | | | | We should build the routes using the user facing API which is `Mapper`. This frees up the library internals to change as we see fit. IOW we shouldn't be testing internals.
* only keep one hash of named routesAaron Patterson2015-08-142-13/+14
| | | | | The outer router object already keeps a hash of named routes, so we should just use that.
* rm add_route2Aaron Patterson2015-08-142-41/+51
| | | | | refactor the tests with a backwards compatible method call so we can rm add_route2 from the journey router
* use predicate methods instead of hard coding verb stringsAaron Patterson2015-08-141-5/+4
| | | | | also change the feeler to subclass AD::Request so that it has all the methods that Request has
* remove StrexpAaron Patterson2015-08-134-74/+61
| | | | | This was a useless object. We can just directly construct a Path::Pattern object without a Strexp object.
* pass anchor directly to `Pattern`Aaron Patterson2015-08-134-39/+38
| | | | | the caller already has it, there is no reason to pack it in to an object and just throw that object away.
* Revert "Merge pull request #20584 from arthurnn/fix_url"Arthur Neves2015-06-171-7/+0
| | | | | | | | This reverts commit 0b3397872582f2cf1bc6960960a6393f477c55e6, reversing changes made to 56d52e3749180e6c1dcf7166adbad967470aa78b. As pointed out on the PR, this will hide development mistakes too, which is not ideal.
* Catch InvalidURIError on bad paths on redirect.Arthur Neves2015-06-161-0/+7
| | | | | Handle URI::InvalidURIError errors on the redirect route method, so it wont raise a 500 if a bad path is given.
* extract required_defaults from the conditions hash before constructing the routeAaron Patterson2015-06-083-48/+48
| | | | | this way we can remove the strange "respond_to?" conditional in the `matches?` loop
* Prefer assert_not over refuteRafael Mendonça França2015-05-181-1/+1
|
* ActionDispatch::Journey::Routes#empty? test casesValentine Valyaeff2015-05-191-0/+2
|
* Silence ambiguous first argument warningPrem Sichanugrist2015-05-041-1/+1
| | | | | | | This silences: actionpack/test/journey/route_test.rb:33: warning: ambiguous first argument; put parentheses or a space even after `/' operator
* Merge pull request #18392 from brainopia/fix_route_requirementsArthur Nogueira Neves2015-04-271-0/+8
|\ | | | | Correct route requirements by overriding defaultls
| * Correct route requirements by overriding defaultls (fixes #18373)brainopia2015-01-081-0/+8
| |
* | sort_by instead of sortYang Bo2015-04-081-0/+27
| | | | | | | | | | | | it is avoid sort errot within different and mixed keys. used `sort_by` + `block` to list parameter by keys. keep minimum changes