# \`test': wrong number of arguments (1 for 2) (ArgumentError)

**URL:** <https://www.ruby-forum.com/t/test-wrong-number-of-arguments-1-for-2-argumenterror/186348>\
**Category:** Rails\
**Created:** [April 5, 2010, 1:41pm UTC](https://www.ruby-forum.com/t/test-wrong-number-of-arguments-1-for-2-argumenterror/186348 "2010-04-05T13:41:57Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![ram](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/b9bd4f/32.png) [@ram](https://www.ruby-forum.com/u/ram)\
**Post date:** [April 5, 2010, 1:41pm UTC](https://www.ruby-forum.com/t/test-wrong-number-of-arguments-1-for-2-argumenterror/186348/1 "2010-04-05T13:41:57Z")

</div>

Hi,

Im trying to change the syntax of my tests to the

test “some method” do  
…  
end

syntax from the existing

def test\_some\_method  
…  
end

syntax. Im pasting my test code below. Im getting the error in the  
subject line if I try to run the test as a ruby script from the  
console.

require File.dirname( **FILE** ) + ‘/…/test\_helper’  
require ‘accounts\_controller’

class AccountsController; def rescue\_action(e) raise e end; end

class AccountsControllerTest \< ActionController::TestCase

fixtures :accounts

def setup  
@controller = AccountsController.new  
@request = ActionController::TestRequest.new  
@response = ActionController::TestResponse.new  
end

test “should allow signup” do  
assert\_difference ‘Account.count’ do  
create\_account  
assert\_response :redirect  
end  
end

protected  
def create\_account(options = {})  
post :create, :account =\> { :name =\> ‘who’, :email =\>  
‘removed\_email\_address@domain.invalid’,  
:password =\> ‘who’, :password\_confirmation =\>  
‘who’ }.merge(options)  
end  
end

Am I missing something here? Im running Rails 2.1.0 .

---

<div class="post-metadata">

**Author:** ![ram](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/b9bd4f/32.png) [@ram](https://www.ruby-forum.com/u/ram)\
**Post date:** [April 5, 2010, 2:14pm UTC](https://www.ruby-forum.com/t/test-wrong-number-of-arguments-1-for-2-argumenterror/186348/2 "2010-04-05T14:14:43Z")

</div>

On Apr 5, 12:40 pm, Ram [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> Hi,
> 
> Im trying to change the syntax of my tests to the
> 
> test “some method” do  
> …  
> end

[snip]

> Am I missing something here? Im running Rails 2.1.0 .

That feature was only added after rails 2.1 if my memory is correct.

Fred
