SitePoint Sponsor |
|
User Tag List
Results 1 to 5 of 5
Hybrid View
-
Nov 21, 2005, 09:55 #1
- Join Date
- Nov 2005
- Posts
- 14
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
using url_for() in a functional test
Hallo -- I have an assertion in a functional test that looks like this:
Code:assert_redirected_to :controller=>'properties',:action=>'list'
Code:response is not a redirection to all of the options supplied (redirection is <"http://test.host/properties/list">)
Code:url=url_for(:controller=>'properties',:action=>'list') # more code here... redirect_to(url)
Code:assert_redirected_to(url_for(:controller=>'properties',:action=>'list'))
Can anyone help here?
Cheers,
doug.
-
Nov 21, 2005, 10:07 #2
- Join Date
- Jun 2003
- Location
- Iowa, USA
- Posts
- 3,749
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
perhaps
Code:assert_redirected_to(ActionController::Base::url_for(:controller=>'properties',:action=>'list'))
Jason Sweat ZCE - jsweat_php@yahoo.com
Book: PHP Patterns
Good Stuff: SimpleTest PHPUnit FireFox ADOdb YUI
Detestable (adjective): software that isn't testable.
-
Nov 21, 2005, 20:58 #3
- Join Date
- May 2002
- Location
- Berkeley
- Posts
- 76
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
I'm assuming that before your assert_redirected_to() call you called
redirect_tocontroller=>'properties', :action=>list)
If this is the case, I think you only need to call assert_redirected_toaction=>'list') as rails knows you're using the 'properties' controller.
-
Nov 22, 2005, 07:59 #4
Is there a reason why you are doing:
Code:url=url_for(:controller=>'properties',:action=>'list') # more code here... redirect_to(url)
Code:redirect_to :controller=>'properties',:action=>'list'
http://www.rubygarden.org/ruby?RubyStyleGuide
-
Nov 23, 2005, 09:36 #5
- Join Date
- Nov 2005
- Posts
- 14
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
Cheers for those -- the reason for any stupid errors is that I am still learning ruby & rails. Well, that & my being stupid anyway...
Thanks alot,
doug.
Bookmarks