# Assert\_select

**URL:** <https://www.ruby-forum.com/t/assert-select/89348>\
**Category:** Rails\
**Created:** [March 19, 2007, 6:49pm UTC](https://www.ruby-forum.com/t/assert-select/89348 "2007-03-19T18:49:10Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Chris\_Ovenden](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/e274bd/32.png) [@Chris\_Ovenden](https://www.ruby-forum.com/u/Chris_Ovenden)\
**Post date:** [March 19, 2007, 6:49pm UTC](https://www.ruby-forum.com/t/assert-select/89348/1 "2007-03-19T18:49:10Z")

</div>

Hi all

This is my first post here. I ave been using Rails for a couple of  
months, and am starting to put together a test suite. But I’m having a  
problem with assert\_select in my functional tests.

According to the documentation, it should be fine with two arguments -  
a CSS selector and a string to test it against. But no matter what I  
do I keep getting the exception:

wrong number of arguments (6 for 2)

It’s defnitely the assert-select line that’s throwing the error - the  
other tests work if I put  
that one in a begin-rescue block. I can’t even get an example from the  
assert\_select cheat sheet to run.

I’m using Rails 1.2.3, running on ruby 1.8.2 (yeah, I know that’s old,  
but we’re using Debian…)

Any help would be appreciated.

–  
Chris Ovenden

[http://thepeer.blogspot.com](http://thepeer.blogspot.com)  
“Imagine all the people / Sharing all the world”

---

<div class="post-metadata">

**Author:** ![Chris\_Ovenden](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/e274bd/32.png) [@Chris\_Ovenden](https://www.ruby-forum.com/u/Chris_Ovenden)\
**Post date:** [March 19, 2007, 6:59pm UTC](https://www.ruby-forum.com/t/assert-select/89348/2 "2007-03-19T18:59:00Z")

</div>

Chris Ovenden wrote:

> wrong number of arguments (6 for 2)

What does your assert\_select line and stack trace look like? Are you  
sure your not passing 6 arguments to assert\_select?

---

<div class="post-metadata">

**Author:** ![Chris\_Ovenden](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/e274bd/32.png) [@Chris\_Ovenden](https://www.ruby-forum.com/u/Chris_Ovenden)\
**Post date:** [March 19, 2007, 7:11pm UTC](https://www.ruby-forum.com/t/assert-select/89348/3 "2007-03-19T19:11:15Z")

</div>

On 3/19/07, Alex W. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> Chris Ovenden wrote:
> 
> > wrong number of arguments (6 for 2)
> 
> What does your assert\_select line and stack trace look like? Are you  
> sure your not passing 6 arguments to assert\_select?

It doesn’t do anything real, yet, just:

assert\_select “title”, “Used”

Stack trace is:

test\_index(MainControllerTest):  
ArgumentError: wrong number of arguments (6 for 2)  
C:/ruby/lib/ruby/gems/1.8/gems/actionpack-1.13.3/lib/action\_controller/assertions/…/vendor/html-scanner/html/node.rb:199:in  
`initialize' C:/ruby/lib/ruby/gems/1.8/gems/actionpack-1.13.3/lib/action_controller/assertions/../vendor/html-scanner/html/node.rb:199:in `new’  
C:/ruby/lib/ruby/gems/1.8/gems/actionpack-1.13.3/lib/action\_controller/assertions/…/vendor/html-scanner/html/node.rb:199:in  
`parse' C:/ruby/lib/ruby/gems/1.8/gems/actionpack-1.13.3/lib/action_controller/assertions/../vendor/html-scanner/html/document.rb:20:in `initialize’  
C:/ruby/lib/ruby/gems/1.8/gems/actionpack-1.13.3/lib/action\_controller/test\_process.rb:439:in  
`new' C:/ruby/lib/ruby/gems/1.8/gems/actionpack-1.13.3/lib/action_controller/test_process.rb:439:in `html\_document’  
C:/ruby/lib/ruby/gems/1.8/gems/actionpack-1.13.3/lib/action\_controller/assertions/selector\_assertions.rb:555:in  
`response_from_page_or_rjs' C:/ruby/lib/ruby/gems/1.8/gems/actionpack-1.13.3/lib/action_controller/assertions/selector_assertions.rb:197:in `assert\_select’  
Z:/AffiliateSites/Hitachi/test/functional/main\_controller\_test.rb:36:in  
`test\_index’

–  
Chris Ovenden

[http://thepeer.blogspot.com](http://thepeer.blogspot.com)  
“Imagine all the people / Sharing all the world”

---

<div class="post-metadata">

**Author:** ![Chris\_Ovenden](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/e274bd/32.png) [@Chris\_Ovenden](https://www.ruby-forum.com/u/Chris_Ovenden)\
**Post date:** [March 19, 2007, 7:45pm UTC](https://www.ruby-forum.com/t/assert-select/89348/4 "2007-03-19T19:45:28Z")

</div>

Would you mind posting your whole text\_index method? Based on the one  
line you posted, there’s no reason why you should be getting that  
error message.
