# Test weirdness

**URL:** <https://www.ruby-forum.com/t/test-weirdness/175681>\
**Category:** Rails\
**Created:** [September 17, 2009, 4:32pm UTC](https://www.ruby-forum.com/t/test-weirdness/175681 "2009-09-17T16:32:17Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Dudebot](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/e495f1/32.png) [@Dudebot](https://www.ruby-forum.com/u/Dudebot)\
**Post date:** [September 17, 2009, 4:32pm UTC](https://www.ruby-forum.com/t/test-weirdness/175681/1 "2009-09-17T16:32:17Z")

</div>

Hi gurus,

I have this in routes.rb:

map.root :controller =\> ‘items’

This in my method controller

redirect\_to\_root( msg = ‘Oops!’ )

And this in my application controller

def redirect\_to\_root( msg = nil )  
flash[:notice] = msg if msg  
redirect\_to root\_path  
end

With this in my functionals test for the method,

assert\_redirected\_to root\_path

I get the following error on rake test:functionals

1. Failure:  
test\_should\_create\_donor(DonorsControllerTest) [/test/functional/  
donors\_controller\_test.rb:29]:  
Expected response to be a redirect to [http://test.host/](http://test.host/) but was a  
redirect to [http://test.host/items](http://test.host/items).

Any idea how to fix this? I’ve spent hours trying to eliminate this  
error…

Many TIA,  
Craig
