summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/main/scala/router.scala13
-rw-r--r--src/test/scala/basic.scala25
2 files changed, 12 insertions, 26 deletions
diff --git a/src/main/scala/router.scala b/src/main/scala/router.scala
index 3b15ca8..7f60dec 100644
--- a/src/main/scala/router.scala
+++ b/src/main/scala/router.scala
@@ -13,19 +13,6 @@ class Router[T] {
routes += new Route(path, defaults, validations, target)
}
- def insertRoute (
- path: String,
- target: T,
- defaults: Map[String, String] = Map(),
- validations: Map[String, Regex] = Map(),
- at: Int = 0
- ) {
- routes insert (
- at min routes.length,
- new Route(path, defaults, validations, target)
- )
- }
-
def route (path: String): Option[Match[T]] = {
def testRoutes (
components: Seq[String],
diff --git a/src/test/scala/basic.scala b/src/test/scala/basic.scala
index 71aa370..bf22361 100644
--- a/src/test/scala/basic.scala
+++ b/src/test/scala/basic.scala
@@ -8,6 +8,16 @@ class Basic extends FunSuite {
val dayRx = """\d|[12]\d|30|31""".r
val router = new Router[Boolean]
+
+ router addRoute (
+ "blog",
+ true,
+ defaults = Map(
+ "controller" -> "blog",
+ "action" -> "index"
+ )
+ )
+
router addRoute (
"blog/:year/:month/:day",
true,
@@ -22,19 +32,9 @@ class Basic extends FunSuite {
)
)
- router insertRoute (
- "blog",
- true,
- defaults = Map(
- "controller" -> "blog",
- "action" -> "index"
- )
- )
-
- router insertRoute (
+ router addRoute (
"blog/:action/:id",
true,
- at = 2,
defaults = Map(
"controller" -> "blog"
),
@@ -44,10 +44,9 @@ class Basic extends FunSuite {
)
)
- router insertRoute (
+ router addRoute (
"test/?:x/?:y",
true,
- at = 1000000,
defaults = Map(
"controller" -> "test",
"x" -> "x",