Namespace
Methods
T
Instance Public methods
test_initialize()
# File actionpack/test/dispatch/mapper_test.rb, line 35
def test_initialize
  Mapper.new FakeSet.new
end
test_map_more_slashes()
# File actionpack/test/dispatch/mapper_test.rb, line 53
def test_map_more_slashes
  fakeset = FakeSet.new
  mapper = Mapper.new fakeset

  # FIXME: is this a desired behavior?
  mapper.get '/one/two/', :to => 'posts#index', :as => :main
  assert_equal '/one/two(.:format)', fakeset.conditions.first[:path_info]
end
test_map_slash()
# File actionpack/test/dispatch/mapper_test.rb, line 46
def test_map_slash
  fakeset = FakeSet.new
  mapper = Mapper.new fakeset
  mapper.get '/', :to => 'posts#index', :as => :main
  assert_equal '/', fakeset.conditions.first[:path_info]
end
test_map_wildcard()
# File actionpack/test/dispatch/mapper_test.rb, line 62
def test_map_wildcard
  fakeset = FakeSet.new
  mapper = Mapper.new fakeset
  mapper.get '/*path', :to => 'pages#show'
  assert_equal '/*path(.:format)', fakeset.conditions.first[:path_info]
  assert_equal(/.+?/, fakeset.requirements.first[:path])
end
test_map_wildcard_with_format_false()
# File actionpack/test/dispatch/mapper_test.rb, line 87
def test_map_wildcard_with_format_false
  fakeset = FakeSet.new
  mapper = Mapper.new fakeset
  mapper.get '/*path', :to => 'pages#show', :format => false
  assert_equal '/*path', fakeset.conditions.first[:path_info]
  assert_nil fakeset.requirements.first[:path]
end
test_map_wildcard_with_format_true()
# File actionpack/test/dispatch/mapper_test.rb, line 95
def test_map_wildcard_with_format_true
  fakeset = FakeSet.new
  mapper = Mapper.new fakeset
  mapper.get '/*path', :to => 'pages#show', :format => true
  assert_equal '/*path.:format', fakeset.conditions.first[:path_info]
end
test_map_wildcard_with_multiple_wildcard()
# File actionpack/test/dispatch/mapper_test.rb, line 78
def test_map_wildcard_with_multiple_wildcard
  fakeset = FakeSet.new
  mapper = Mapper.new fakeset
  mapper.get '/*foo/*bar', :to => 'pages#show'
  assert_equal '/*foo/*bar(.:format)', fakeset.conditions.first[:path_info]
  assert_equal(/.+?/, fakeset.requirements.first[:foo])
  assert_equal(/.+?/, fakeset.requirements.first[:bar])
end
test_map_wildcard_with_other_element()
# File actionpack/test/dispatch/mapper_test.rb, line 70
def test_map_wildcard_with_other_element
  fakeset = FakeSet.new
  mapper = Mapper.new fakeset
  mapper.get '/*path/foo/:bar', :to => 'pages#show'
  assert_equal '/*path/foo/:bar(.:format)', fakeset.conditions.first[:path_info]
  assert_equal(/.+?/, fakeset.requirements.first[:path])
end
test_mapping_requirements()
# File actionpack/test/dispatch/mapper_test.rb, line 39
def test_mapping_requirements
  options = { :controller => 'foo', :action => 'bar', :via => :get }
  m = Mapper::Mapping.build({}, FakeSet.new, '/store/:name(*rest)', nil, options)
  _, _, requirements, _ = m.to_route
  assert_equal(/.+?/, requirements[:rest])
end
test_raising_helpful_error_on_invalid_arguments()
# File actionpack/test/dispatch/mapper_test.rb, line 102
def test_raising_helpful_error_on_invalid_arguments
  fakeset = FakeSet.new
  mapper = Mapper.new fakeset
  app = lambda { |env| [200, {}, [""]] }
  assert_raises ArgumentError do
    mapper.mount app
  end
end