diff options
author | Jeremy Kemper <jeremy@bitsweat.net> | 2007-10-15 04:27:31 +0000 |
---|---|---|
committer | Jeremy Kemper <jeremy@bitsweat.net> | 2007-10-15 04:27:31 +0000 |
commit | ae8179f05c49867e1136204bdf6d14a8fd4a7596 (patch) | |
tree | 29a3898da8cd5f31516ddbac5a85e8c0cefd446e /actionpack | |
parent | e81f1acc33a642df68c32d28202dcf589a79d714 (diff) | |
download | rails-ae8179f05c49867e1136204bdf6d14a8fd4a7596.tar.gz rails-ae8179f05c49867e1136204bdf6d14a8fd4a7596.tar.bz2 rails-ae8179f05c49867e1136204bdf6d14a8fd4a7596.zip |
Expand Routes::DynamicSegment test coverage. Closes #7122 [Kevin Clark]
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@7898 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
Diffstat (limited to 'actionpack')
-rw-r--r-- | actionpack/test/controller/routing_test.rb | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/actionpack/test/controller/routing_test.rb b/actionpack/test/controller/routing_test.rb index ce897db238..f2bd9f4301 100644 --- a/actionpack/test/controller/routing_test.rb +++ b/actionpack/test/controller/routing_test.rb @@ -874,6 +874,28 @@ class DynamicSegmentTest < Test::Unit::TestCase assert_kind_of String, segment.regexp_chunk end + def test_build_pattern_non_optional_with_no_captures + # Non optioanl + a_segment = ROUTING::DynamicSegment.new + a_segment.regexp = /\d+/ #number_of_captures is 0 + assert_equal "(\\d+)stuff", a_segment.build_pattern('stuff') + end + + def test_build_pattern_non_optional_with_captures + # Non optioanl + a_segment = ROUTING::DynamicSegment.new + a_segment.regexp = /(\d+)(.*?)/ #number_of_captures is 2 + assert_equal "((\\d+)(.*?))stuff", a_segment.build_pattern('stuff') + end + + def test_optionality_implied + a_segment = ROUTING::DynamicSegment.new + a_segment.key = :id + assert a_segment.optionality_implied? + + a_segment.key = :action + assert a_segment.optionality_implied? + end end class ControllerSegmentTest < Test::Unit::TestCase |