From 56fee39c392788314c44a575b3fd66e16a50c8b5 Mon Sep 17 00:00:00 2001 From: Andrew White Date: Wed, 19 Dec 2012 20:54:47 +0000 Subject: Integrate Journey into Action Dispatch Move the Journey code underneath the ActionDispatch namespace so that we don't pollute the global namespace with names that may be used for models. Fixes rails/journey#49. --- actionpack/test/journey/router/strexp_test.rb | 32 +++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 actionpack/test/journey/router/strexp_test.rb (limited to 'actionpack/test/journey/router/strexp_test.rb') diff --git a/actionpack/test/journey/router/strexp_test.rb b/actionpack/test/journey/router/strexp_test.rb new file mode 100644 index 0000000000..9e0337f144 --- /dev/null +++ b/actionpack/test/journey/router/strexp_test.rb @@ -0,0 +1,32 @@ +require 'abstract_unit' + +module ActionDispatch + module Journey + class Router + class TestStrexp < MiniTest::Unit::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 -- cgit v1.2.3