1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00
rails--rails/actionpack/test/journey/router/strexp_test.rb
2012-12-31 14:40:43 -03:00

32 lines
896 B
Ruby

require 'abstract_unit'
module ActionDispatch
module Journey
class Router
class TestStrexp < ActiveSupport::TestCase
def test_many_names
exp = Strexp.new(
"/: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.new(string, {}, ["/", ".", "?"])
assert_equal expected, exp.names
end
end
end
end
end
end