Added tests

Added test and fixed an issue with optional url parts not being correctly stripped:

```
# Before without the type param
/bar/[:controller]/[:action].[:type]? => /bar/test/action.

# Now without the type param
/bar/[:controller]/[:action].[:type]? => /bar/test/action
```

Although there is still one issue left:

```
# URL                With route
/bar/test/do.json => /bar/[:controller]/[:action].[:type]?

# Results in
array('controller' => 'test', 'action' => 'do.json');

# Should result in
array('controller' => 'test', 'action' => 'do', 'type' => 'json');
```