From: Phlip Date: 2007-09-16T11:30:07+09:00 Subject: Re: where is wrong with contoller test? OnRails Ruby wrote: > I got a strange question when I did a controller test as below The best place for Rails question is the Google Group called "Ruby on Rails: Talk". And you had better get at least the book /Agile Web Development on Rails/ before programming any more. > On controller.rb: > > def send_welcome_message(person) > some codes; > end > there 'person' is instance variables. It is not; it's a method parameter. However, actions don't (typically) take arguments. They always get data from their web pages from the params hash, so you need to use person = params[:person] > ArgumentError: wrong number of arguments (0 for 1) Right; the test rig did not pass person where you think it did, but the action was expecting it there. Take it out of the action's arguments. BTW congrats for testing; it will make all this stuff easier as you go! -- Phlip http://www.oreilly.com/catalog/9780596510657/ "Test Driven Ajax (on Rails)" assert_xpath, assert_javascript, & assert_ajax