Ruby on Rails | Screencasts | Download | Documentation | Weblog | Community | Source

Changeset 7898

Show
Ignore:
Timestamp:
10/15/07 04:27:31 (1 year ago)
Author:
bitsweat
Message:

Expand Routes::DynamicSegment test coverage. Closes #7122 [Kevin Clark]

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/actionpack/test/controller/routing_test.rb

    r7849 r7898  
    875875  end 
    876876   
     877  def test_build_pattern_non_optional_with_no_captures 
     878    # Non optioanl 
     879    a_segment = ROUTING::DynamicSegment.new 
     880    a_segment.regexp = /\d+/ #number_of_captures is 0 
     881    assert_equal "(\\d+)stuff", a_segment.build_pattern('stuff') 
     882  end 
     883 
     884  def test_build_pattern_non_optional_with_captures 
     885    # Non optioanl 
     886    a_segment = ROUTING::DynamicSegment.new 
     887    a_segment.regexp = /(\d+)(.*?)/ #number_of_captures is 2 
     888    assert_equal "((\\d+)(.*?))stuff", a_segment.build_pattern('stuff') 
     889  end 
     890 
     891  def test_optionality_implied 
     892    a_segment = ROUTING::DynamicSegment.new 
     893    a_segment.key = :id 
     894    assert a_segment.optionality_implied? 
     895 
     896    a_segment.key = :action 
     897    assert a_segment.optionality_implied? 
     898  end 
    877899end 
    878900