# \[test\] assert response or redirect

**URL:** <https://www.ruby-forum.com/t/test-assert-response-or-redirect/104575>\
**Category:** Rails\
**Created:** [May 19, 2007, 8:00pm UTC](https://www.ruby-forum.com/t/test-assert-response-or-redirect/104575 "2007-05-19T20:00:43Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![kadoudal](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/k/f0a364/32.png) [@kadoudal](https://www.ruby-forum.com/u/kadoudal)\
**Post date:** [May 19, 2007, 8:00pm UTC](https://www.ruby-forum.com/t/test-assert-response-or-redirect/104575/1 "2007-05-19T20:00:43Z")

</div>

I am testing my update action

```
  render :update do |page|
    page.redirect_to :controller => 'proposals', :action => 'list'
  end

```

if I asser a response

```
post :update
assert_response 200

```

it’s OK

but not if I try to assert the redirect

assert\_redirected\_to “/proposals/list/”

is it the right assertion ?

tfy help

kad

---

<div class="post-metadata">

**Author:** ![kadoudal](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/k/f0a364/32.png) [@kadoudal](https://www.ruby-forum.com/u/kadoudal)\
**Post date:** [May 20, 2007, 3:38pm UTC](https://www.ruby-forum.com/t/test-assert-response-or-redirect/104575/2 "2007-05-20T15:38:48Z")

</div>

On 5/19/07, Kad K. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> is it the right assertion ?
> 
> tfy help
> 
> kad

This redirection is done via ajax calls, response will always be 200.  
You should take a look at this plugin to test ajax calls :  
[http://glu.ttono.us/articles/2006/05/29/guide-test-driven-rjs-with-arts](http://glu.ttono.us/articles/2006/05/29/guide-test-driven-rjs-with-arts)

or do a ‘real’ redirection.
