class TestNamespaceWithControllerOption

Public Instance Methods

draw(&block) click to toggle source
# File actionpack/test/dispatch/routing_test.rb, line 3885
def draw(&block)
  routes = ActionDispatch::Routing::RouteSet.new
  routes.draw(&block)
  @app = self.class.build_app routes
end
test_missing_action_on_hash() click to toggle source
# File actionpack/test/dispatch/routing_test.rb, line 3909
def test_missing_action_on_hash
  ex = assert_raises(ArgumentError) {
    draw do
      get "/foo/bar", to: "foo#"
    end
  }
  assert_match(/Missing :action/, ex.message)
end
test_missing_controller() click to toggle source
# File actionpack/test/dispatch/routing_test.rb, line 3891
def test_missing_controller
  ex = assert_raises(ArgumentError) {
    draw do
      get "/foo/bar", action: :index
    end
  }
  assert_match(/Missing :controller/, ex.message)
end
test_missing_controller_with_to() click to toggle source
# File actionpack/test/dispatch/routing_test.rb, line 3900
def test_missing_controller_with_to
  ex = assert_raises(ArgumentError) {
    draw do
      get "/foo/bar", to: "foo"
    end
  }
  assert_match(/Missing :controller/, ex.message)
end
test_resources_with_valid_namespaced_controller_option() click to toggle source
# File actionpack/test/dispatch/routing_test.rb, line 3929
def test_resources_with_valid_namespaced_controller_option
  draw do
    resources :storage_files, controller: "admin/storage_files"
  end

  get "/storage_files"
  assert_equal "admin/storage_files#index", @response.body
end
test_valid_controller_options_inside_namespace() click to toggle source
# File actionpack/test/dispatch/routing_test.rb, line 3918
def test_valid_controller_options_inside_namespace
  draw do
    namespace :admin do
      resources :storage_files, controller: "storage_files"
    end
  end

  get "/admin/storage_files"
  assert_equal "admin/storage_files#index", @response.body
end
test_warn_with_ruby_constant_syntax_controller_option() click to toggle source
# File actionpack/test/dispatch/routing_test.rb, line 3938
def test_warn_with_ruby_constant_syntax_controller_option
  e = assert_raise(ArgumentError) do
    draw do
      namespace :admin do
        resources :storage_files, controller: "StorageFiles"
      end
    end
  end

  assert_match "'admin/StorageFiles' is not a supported controller name", e.message
end
test_warn_with_ruby_constant_syntax_namespaced_controller_option() click to toggle source
# File actionpack/test/dispatch/routing_test.rb, line 3950
def test_warn_with_ruby_constant_syntax_namespaced_controller_option
  e = assert_raise(ArgumentError) do
    draw do
      resources :storage_files, controller: "Admin::StorageFiles"
    end
  end

  assert_match "'Admin::StorageFiles' is not a supported controller name", e.message
end
test_warn_with_ruby_constant_syntax_no_colons() click to toggle source
# File actionpack/test/dispatch/routing_test.rb, line 3960
def test_warn_with_ruby_constant_syntax_no_colons
  e = assert_raise(ArgumentError) do
    draw do
      resources :storage_files, controller: "Admin"
    end
  end

  assert_match "'Admin' is not a supported controller name", e.message
end