batmanjs/batman — pull request #999 by jouh (2014-03-12 12:20:28+00:00)
Title: Default to the current controller when redirecting with an object

This change fixes so the controller defaults to the current one (if not already present) when doing a redirect from a controller with an object;

``` coffeescript
class App.ProductsController extends App.ApplicationController

show: ->
@redirect(action: ‘edit’)

edit: ->
```

The docs already says that this should work so I guess it’s a bug.

I tried to write a test (in controller_test.coffee) but wasn’t able to get it to work;

``` coffeescript
test 'redirecting with an object should add the current controller if not present', ->
@controller.show = createSpy()
@controller.redirect(action: 'show')
ok @controller.show.called
```

It seems like the redirect isn’t performed or maybe I'm doing it wrong. I’m pretty new to writing tests so any help is appreciated. :)