Namespace
Methods
- T
-
- test_blows_up_without_via,
- test_initialize,
- test_map_more_slashes,
- test_map_slash,
- test_map_wildcard,
- test_map_wildcard_with_format_false,
- test_map_wildcard_with_format_true,
- test_map_wildcard_with_multiple_wildcard,
- test_map_wildcard_with_other_element,
- test_mapping_requirements,
- test_raising_error_when_path_is_not_passed,
- test_raising_error_when_rack_app_is_not_passed,
- test_random_keys,
- test_scope_does_not_destructively_mutate_default_options,
- test_scope_raises_on_anchor,
- test_scoped_formatted,
- test_to_scope,
- test_unscoped_formatted,
- test_via_scope
Instance Public methods
test_blows_up_without_via()
Link
test_initialize()
Link
test_map_more_slashes()
Link
# File actionpack/test/dispatch/mapper_test.rb, line 124 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.asts.first.to_s end
test_map_slash()
Link
test_map_wildcard()
Link
# File actionpack/test/dispatch/mapper_test.rb, line 133 def test_map_wildcard fakeset = FakeSet.new mapper = Mapper.new fakeset mapper.get '/*path', :to => 'pages#show' assert_equal '/*path(.:format)', fakeset.asts.first.to_s assert_equal(/.+?/, fakeset.requirements.first[:path]) end
test_map_wildcard_with_format_false()
Link
# File actionpack/test/dispatch/mapper_test.rb, line 158 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.asts.first.to_s assert_nil fakeset.requirements.first[:path] end
test_map_wildcard_with_format_true()
Link
test_map_wildcard_with_multiple_wildcard()
Link
# File actionpack/test/dispatch/mapper_test.rb, line 149 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.asts.first.to_s assert_equal(/.+?/, fakeset.requirements.first[:foo]) assert_equal(/.+?/, fakeset.requirements.first[:bar]) end
test_map_wildcard_with_other_element()
Link
# File actionpack/test/dispatch/mapper_test.rb, line 141 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.asts.first.to_s assert_equal(/.+?/, fakeset.requirements.first[:path]) end
test_mapping_requirements()
Link
# File actionpack/test/dispatch/mapper_test.rb, line 88 def test_mapping_requirements options = { } scope = Mapper::Scope.new({}) ast = Journey::Parser.parse '/store/:name(*rest)' m = Mapper::Mapping.build(scope, FakeSet.new, ast, 'foo', 'bar', nil, [:get], nil, {}, true, options) assert_equal(/.+?/, m.requirements[:rest]) end
test_raising_error_when_path_is_not_passed()
Link
test_raising_error_when_rack_app_is_not_passed()
Link
# File actionpack/test/dispatch/mapper_test.rb, line 182 def test_raising_error_when_rack_app_is_not_passed fakeset = FakeSet.new mapper = Mapper.new fakeset assert_raises ArgumentError do mapper.mount 10, as: "exciting" end assert_raises ArgumentError do mapper.mount as: "exciting" end end
test_random_keys()
Link
# File actionpack/test/dispatch/mapper_test.rb, line 77 def test_random_keys fakeset = FakeSet.new mapper = Mapper.new fakeset mapper.scope(omg: :awesome) do mapper.get '/', :to => 'posts#index', :as => :main end assert_equal({:omg=>:awesome, :controller=>"posts", :action=>"index"}, fakeset.defaults.first) assert_equal("GET", fakeset.routes.first.verb) end
test_scope_does_not_destructively_mutate_default_options()
Link
# File actionpack/test/dispatch/mapper_test.rb, line 194 def test_scope_does_not_destructively_mutate_default_options fakeset = FakeSet.new mapper = Mapper.new fakeset frozen = { foo: :bar }.freeze assert_nothing_raised do mapper.scope(defaults: frozen) do # pass end end end
test_scope_raises_on_anchor()
Link
test_scoped_formatted()
Link
# File actionpack/test/dispatch/mapper_test.rb, line 66 def test_scoped_formatted fakeset = FakeSet.new mapper = Mapper.new fakeset mapper.scope(format: true) do mapper.get '/foo', :to => 'posts#index', :as => :main end assert_equal({:controller=>"posts", :action=>"index"}, fakeset.defaults.first) assert_equal "/foo.:format", fakeset.asts.first.to_s end
test_to_scope()
Link
# File actionpack/test/dispatch/mapper_test.rb, line 105 def test_to_scope fakeset = FakeSet.new mapper = Mapper.new fakeset mapper.scope(to: "posts#index") do mapper.get :all mapper.post :most end assert_equal "posts#index", fakeset.routes.to_a[0].defaults[:to] assert_equal "posts#index", fakeset.routes.to_a[1].defaults[:to] end
test_unscoped_formatted()
Link
# File actionpack/test/dispatch/mapper_test.rb, line 57 def test_unscoped_formatted fakeset = FakeSet.new mapper = Mapper.new fakeset mapper.get '/foo', :to => 'posts#index', :as => :main, :format => true assert_equal({:controller=>"posts", :action=>"index"}, fakeset.defaults.first) assert_equal "/foo.:format", fakeset.asts.first.to_s end
test_via_scope()
Link