# Wrong number of arguments (2 for 1)

**URL:** <https://www.ruby-forum.com/t/wrong-number-of-arguments-2-for-1/161374>\
**Category:** RSpec\
**Created:** [February 26, 2009, 12:01am UTC](https://www.ruby-forum.com/t/wrong-number-of-arguments-2-for-1/161374 "2009-02-26T00:01:13Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![hayafirst](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/h/13edae/32.png) [@hayafirst](https://www.ruby-forum.com/u/hayafirst)\
**Post date:** [February 26, 2009, 12:01am UTC](https://www.ruby-forum.com/t/wrong-number-of-arguments-2-for-1/161374/1 "2009-02-26T00:01:13Z")

</div>

The following statement gave me “wrong number of arguments (2 for 1)”  
and it  
is the only error. no stack trace.  
presenter.stub!(:account).and\_return account

any idea? Thanks

Yi

---

<div class="post-metadata">

**Author:** ![hayafirst](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/h/13edae/32.png) [@hayafirst](https://www.ruby-forum.com/u/hayafirst)\
**Post date:** [February 26, 2009, 12:18am UTC](https://www.ruby-forum.com/t/wrong-number-of-arguments-2-for-1/161374/2 "2009-02-26T00:18:48Z")

</div>

On Wed, Feb 25, 2009 at 4:50 PM, Yi Wen [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> The following statement gave me “wrong number of arguments (2 for 1)” and it  
> is the only error. no stack trace.

try running with --backtrace

---

<div class="post-metadata">

**Author:** ![hayafirst](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/h/13edae/32.png) [@hayafirst](https://www.ruby-forum.com/u/hayafirst)\
**Post date:** [February 26, 2009, 12:48am UTC](https://www.ruby-forum.com/t/wrong-number-of-arguments-2-for-1/161374/3 "2009-02-26T00:48:09Z")

</div>

On Wed, Feb 25, 2009 at 2:50 PM, Yi Wen [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> 

Put parentheses around ‘account’.

///ark

---

<div class="post-metadata">

**Author:** ![hayafirst](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/h/13edae/32.png) [@hayafirst](https://www.ruby-forum.com/u/hayafirst)\
**Post date:** [February 26, 2009, 1:18am UTC](https://www.ruby-forum.com/t/wrong-number-of-arguments-2-for-1/161374/4 "2009-02-26T01:18:35Z")

</div>

I haven’t looked into it too much. But I believe it is because I  
implemented  
method\_missing and respond\_to?, which probably conflicts with RSpec’s  
imlementations. I have been wanting to re-implement my functionality in  
another way other than method\_missing for a long time. It seems now is  
the  
perfect time to do so. Thanks!

Yi

---

<div class="post-metadata">

**Author:** ![hayafirst](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/h/13edae/32.png) [@hayafirst](https://www.ruby-forum.com/u/hayafirst)\
**Post date:** [February 26, 2009, 1:19am UTC](https://www.ruby-forum.com/t/wrong-number-of-arguments-2-for-1/161374/5 "2009-02-26T01:19:45Z")

</div>

Unfortunately, it doesn’t solve the problem. Thanks anyway

Yi
