Skip to content
  • Daniel Colson's avatar
    8eec6ee9
    Move Path::Pattern factories into test helper · 8eec6ee9
    Daniel Colson authored
    `Pattern#from_sting` was introduced in bb207ea7 to support creating
    patterns from strings in tests (removing a conditional in the initialize
    method that had been there only for the sake of those tests).
    
    `Pattern#build` was introduced in 947ebe9a, and was similarly used only
    in tests.
    
    My understanding is that [`Mapping#path`][path] is the only place where
    we initialize a `Path::Pattern` in library code.
    
    Since these two methods appear to be used only in tests, this
    commit moves them out of the class and into a test helper.
    
    My reasoning for doing this is that I am doing some performance work
    that may involve a modification to how `Path::Pattern`s get initialized,
    and I will have more confidence in that work if I know for sure that
    these methods are test helpers that can be modified freely.
    
    [path]: https://github.com/rails/rails/blob/master/actionpack/lib/action_dispatch/routing/mapper.rb#L192-L194
    8eec6ee9
    Move Path::Pattern factories into test helper
    Daniel Colson authored
    `Pattern#from_sting` was introduced in bb207ea7 to support creating
    patterns from strings in tests (removing a conditional in the initialize
    method that had been there only for the sake of those tests).
    
    `Pattern#build` was introduced in 947ebe9a, and was similarly used only
    in tests.
    
    My understanding is that [`Mapping#path`][path] is the only place where
    we initialize a `Path::Pattern` in library code.
    
    Since these two methods appear to be used only in tests, this
    commit moves them out of the class and into a test helper.
    
    My reasoning for doing this is that I am doing some performance work
    that may involve a modification to how `Path::Pattern`s get initialized,
    and I will have more confidence in that work if I know for sure that
    these methods are test helpers that can be modified freely.
    
    [path]: https://github.com/rails/rails/blob/master/actionpack/lib/action_dispatch/routing/mapper.rb#L192-L194
Loading