Functional testing post syntax

I’m trying to get my tests for a version 1.2.6 Rails app upgraded to
version 2.0.2. In my functionals, all my calls to post are now
failing. Here’s one:

post :login, :login => { :email => user.email, :password => ‘wrong’ }

The 2nd edition Agile Web D. with Rails book shows that exact
syntax on page 203, and then the docs at http://api.rubyonrails.com/
don’t really lead me to believe the syntax has changed.

So anyway, here’s the error I’m getting:

ArgumentError: wrong number of arguments (1 for 2)
/usr/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/action_controller/url_rewriter.rb:81:in
rewrite_url' /usr/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/action_controller/url_rewriter.rb:81:in rewrite’
/usr/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/action_controller/test_process.rb:445:in
build_request_uri' /usr/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/action_controller/test_process.rb:392:in process’
/usr/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/action_controller/test_process.rb:364:in
post' test/functional/login_controller_test.rb:78:in test_bad_email_password’

Any idea?

Thanks,


Greg D.
http://destiney.com/

Try post ‘login’, :login => { :email => user.email, :password =>
‘wrong’ }

On Thu, Jul 3, 2008 at 10:37 PM, Ryan B. [email protected]
wrote:

Try post ‘login’, :login => { :email => user.email, :password =>
‘wrong’ }

That produces the same error.


Greg D.
http://destiney.com/

On Jul 4, 4:46 am, “Greg D.” [email protected] wrote:

On Thu, Jul 3, 2008 at 10:37 PM, Ryan B. [email protected] wrote:

Try post ‘login’, :login => { :email => user.email, :password =>
‘wrong’ }

That produces the same error.

Have you got a plugin that could be overriding something here. If you
look at the rails source, in an untouched copy of rails 2.0.2,
rewrite_url is only called with 1 argument, not 2 (and does indeed
only accept 1 argument). However in rails 1.2.6 it did require 2
arguments, so my money is on a plugin haven overriden that method.

Fred

On Fri, Jul 4, 2008 at 2:10 AM, Frederick C.
[email protected] wrote:

Have you got a plugin that could be overriding something here. If you
look at the rails source, in an untouched copy of rails 2.0.2,
rewrite_url is only called with 1 argument, not 2 (and does indeed
only accept 1 argument). However in rails 1.2.6 it did require 2
arguments, so my money is on a plugin haven overriden that method.

Thanks so much Fred. This project uses the reverse_proxy_fix plugin
and it simply needed to be upgraded for Rails 2.0. My functional
tests are now passing.


Greg D.
http://destiney.com/