aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/test/controller/routing_test.rb
diff options
context:
space:
mode:
authorAndrew White <andyw@pixeltrix.co.uk>2009-01-16 09:16:18 +0000
committerMichael Koziarski <michael@koziarski.com>2009-02-22 15:35:22 +1300
commit3248553d3299cbb723f1b4103c16bad7ecdd24a6 (patch)
treee6e12e1d5845cec8c4c2ef348bee43ff39a11eb0 /actionpack/test/controller/routing_test.rb
parentf7a0a394f48a0f21e686f891546d17ce33c7840e (diff)
downloadrails-3248553d3299cbb723f1b4103c16bad7ecdd24a6.tar.gz
rails-3248553d3299cbb723f1b4103c16bad7ecdd24a6.tar.bz2
rails-3248553d3299cbb723f1b4103c16bad7ecdd24a6.zip
Fix requirements regexp for path segments
Signed-off-by: Michael Koziarski <michael@koziarski.com> [#1772 state:committed]
Diffstat (limited to 'actionpack/test/controller/routing_test.rb')
-rw-r--r--actionpack/test/controller/routing_test.rb24
1 files changed, 24 insertions, 0 deletions
diff --git a/actionpack/test/controller/routing_test.rb b/actionpack/test/controller/routing_test.rb
index d3fe62e28e..13ba0c30dd 100644
--- a/actionpack/test/controller/routing_test.rb
+++ b/actionpack/test/controller/routing_test.rb
@@ -340,6 +340,30 @@ class ControllerSegmentTest < Test::Unit::TestCase
end
end
+class PathSegmentTest < Test::Unit::TestCase
+ def segment(options = {})
+ unless @segment
+ @segment = ROUTING::PathSegment.new(:path, options)
+ end
+ @segment
+ end
+
+ def test_regexp_chunk_should_return_string
+ segment = segment(:regexp => /[a-z]+/)
+ assert_kind_of String, segment.regexp_chunk
+ end
+
+ def test_regexp_chunk_should_be_wrapped_with_parenthesis
+ segment = segment(:regexp => /[a-z]+/)
+ assert_equal "([a-z]+)", segment.regexp_chunk
+ end
+
+ def test_regexp_chunk_should_respect_options
+ segment = segment(:regexp => /[a-z]+/i)
+ assert_equal "((?i-mx:[a-z]+))", segment.regexp_chunk
+ end
+end
+
class RouteBuilderTest < Test::Unit::TestCase
def builder
@builder ||= ROUTING::RouteBuilder.new