Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Merge pull request #33 from bogdan/refactor_formatter

Route formatter: remove unnecessary gsub call
  • Loading branch information...
commit c1ac1e65d94137002544cb9190d3a138378b0d16 2 parents 47aaabf + 29b62a2
@tenderlove tenderlove authored
Showing with 1 addition and 12 deletions.
  1. +1 −4 lib/journey/route.rb
  2. +0 −8 test/test_route.rb
View
5 lib/journey/route.rb
@@ -71,10 +71,7 @@ def format path_options
path_options.delete key if defaults[key].to_s == path_options[key].to_s
end
- formatter = Visitors::Formatter.new(path_options)
-
- formatted_path = formatter.accept(path.spec)
- formatted_path.gsub(/\/\x00/, '')
+ Visitors::Formatter.new(path_options).accept(path.spec)
end
def optional_parts
View
8 test/test_route.rb
@@ -38,14 +38,6 @@ def test_default_ip
assert_equal(//, route.ip)
end
- def test_format_empty
- path = Path::Pattern.new '/messages/:id(.:format)'
- route = Route.new("name", nil, path, {},
- { :controller => 'foo', :action => 'bar' })
-
- assert_equal '/messages', route.format({})
- end
-
def test_format_with_star
path = Path::Pattern.new '/:controller/*extra'
route = Route.new("name", nil, path, {},
Please sign in to comment.
Something went wrong with that request. Please try again.