提交 5682596d 编写于 作者: A Aaron Patterson

Strexp#names is only used in a test, so rm

上级 333a4d09
......@@ -21,10 +21,6 @@ def initialize(ast, path, requirements, separators, anchor = true)
@separators = separators
@anchor = anchor
end
def names
@path.scan(/:\w+/).map { |s| s.tr(':', '') }
end
end
end
end
......
require 'abstract_unit'
module ActionDispatch
module Journey
class Router
class TestStrexp < ActiveSupport::TestCase
def test_many_names
exp = Strexp.build(
"/:controller(/:action(/:id(.:format)))",
{:controller=>/.+?/},
["/", ".", "?"],
true)
assert_equal ["controller", "action", "id", "format"], exp.names
end
def test_names
{
"/bar(.:format)" => %w{ format },
":format" => %w{ format },
":format-" => %w{ format },
":format0" => %w{ format0 },
":format1,:format2" => %w{ format1 format2 },
}.each do |string, expected|
exp = Strexp.build(string, {}, ["/", ".", "?"])
assert_equal expected, exp.names
end
end
end
end
end
end
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册