# In functional test, assert\_redirected\_to w prefix

**URL:** <https://www.ruby-forum.com/t/in-functional-test-assert-redirected-to-w-prefix/158136>\
**Category:** Rails\
**Created:** [January 19, 2009, 5:51pm UTC](https://www.ruby-forum.com/t/in-functional-test-assert-redirected-to-w-prefix/158136 "2009-01-19T17:51:10Z")\
**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:** [January 19, 2009, 5:51pm UTC](https://www.ruby-forum.com/t/in-functional-test-assert-redirected-to-w-prefix/158136/1 "2009-01-19T17:51:10Z")

</div>

I had to use sub-URI deployment (could not use subdomains…), and when  
running my functional tests, I the redirected\_to assertion embed the  
prefix… quite normal ;-))

is there a way to stipulate this prefix in the test setup to avoid  
hard-coding in all the tests ?

Expected response to be a redirect to [http://test.host/my/page](http://test.host/my/page)  
but was a redirect to [http://test.host/intranet/my/page](http://test.host/intranet/my/page)

/intranet being the prefix in this case …

many thanks for your suggestions

erwin

---

<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:** [January 20, 2009, 9:12am UTC](https://www.ruby-forum.com/t/in-functional-test-assert-redirected-to-w-prefix/158136/2 "2009-01-20T09:12:16Z")

</div>

Kad K. wrote:

> I had to use sub-URI deployment (could not use subdomains…), and when  
> running my functional tests, I the redirected\_to assertion embed the  
> prefix… quite normal ;-))
> 
> is there a way to stipulate this prefix in the test setup to avoid  
> hard-coding in all the tests ?
> 
> Expected response to be a redirect to [http://test.host/my/page](http://test.host/my/page)  
> but was a redirect to [http://test.host/intranet/my/page](http://test.host/intranet/my/page)
> 
> /intranet being the prefix in this case …
> 
> many thanks for your suggestions
> 
> erwin

solved it , wrote in my test :  
ActionController::Base.relative\_url\_root = ‘intranet’
