Assert_select


#1

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
“Imagine all the people / Sharing all the world”


#2

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?


#3

On 3/19/07, Alex W. 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:innew’
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:ininitialize’
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:inhtml_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:inassert_select’
Z:/AffiliateSites/Hitachi/test/functional/main_controller_test.rb:36:in
`test_index’


Chris Ovenden

http://thepeer.blogspot.com
“Imagine all the people / Sharing all the world”


#4

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.