Cookin' with Ruby on Rails - Integration Tests
Subject:   assert_select
Date:   2008-01-02 23:33:18
From:   TechG1rl
Hi, I am hoping someone can help me. I was so excited to see that the new tutorial was up today, as last week I had just finished the July tutorial :) I keep getting these errors on the first integration test.

1. If I run this test:
require File.dirname(__FILE__) + '/../test_helper'

class Cookbook2IntegrationTest < ActionController::IntegrationTest

fixtures :categories
fixtures :recipes

def test_the_home_page

def browse_to_the_home_page
get "/"
assert_response :success
assert_template "recipe/list"

def check_the_home_page_title
assert_select "h1", {:text=>"Online Cookbook"}
I get this response:

Loaded suite cookbook2_integration_test
Finished in 0.245284 seconds.

1) Error:
RuntimeError: expected > (got "" for /var/rails/cookbook2/config/../vendor/rails/actionpack/lib/action_controller/assertions/../vendor/html-scanner/html/node.rb:193:in `parse'
/var/rails/cookbook2/config/../vendor/rails/actionpack/lib/action_controller/assertions/../vendor/html-scanner/html/document.rb:20:in `initialize'
/var/rails/cookbook2/config/../vendor/rails/actionpack/lib/action_controller/test_process.rb:439:in `new'
/var/rails/cookbook2/config/../vendor/rails/actionpack/lib/action_controller/test_process.rb:439:in `html_document'
/var/rails/cookbook2/config/../vendor/rails/actionpack/lib/action_controller/assertions/selector_assertions.rb:555:in `response_from_page_or_rjs'
/var/rails/cookbook2/config/../vendor/rails/actionpack/lib/action_controller/assertions/selector_assertions.rb:197:in `assert_select'
cookbook2_integration_test.rb:21:in `check_the_home_page_title'
cookbook2_integration_test.rb:10:in `test_the_home_page'
/var/rails/cookbook2/config/../vendor/rails/actionpack/lib/action_controller/integration.rb:453:in `run'

1 tests, 2 assertions, 0 failures, 1 errors
I am modifying the tutorial as I go for my system, which is Ubuntu Feisty Fawn, Apache2 as the webserver.

If I run the test without assert_select, it passes with no errors. So, I am wondering if maybe assert_select is not loaded correctly in my rails version???? But, I don't know. Thanks in advance for any help on this.

Happy New Year!

Main Topics Oldest First

Showing messages 1 through 1 of 1.

  • assert_select
    2008-01-03 08:18:51  Bill Walton | [View]

    Hi TechG1rl,

    Happy New Year to you too!

    Wierd. An error typically signals a syntax or typing error in your tests, but nothing jumps out at me in what you submitted. Mismatched quotes will bite you. Spaces where they shouldn't be. Stuff like that. But like I said, nothing like that jumps out at me.

    I'm still on holiday but I'll be happy to investigate further when I get back to my development box. Send me the file (bill dot walton at charter dot net) if you like and I'll see what I can figure out.

    Best regards,