Dave Hoover
Posts: 93
Nickname: dsrhoov53
Registered: Mar, 2004
Dave Hoover is the Lead Consultant for Obtiva
assert_select for Watir
Posted: Jan 8, 2007 9:09 PM
This post originated from an RSS feed registered with Ruby Buzz
by Dave Hoover.
Original Post: assert_select for Watir
Feed Title: Red Squirrel Reflections
Feed URL: http://redsquirrel.com/cgi-bin/dave/index.rss
Feed Description: Dave Hoover explores the psychology of software development
Latest Ruby Buzz Posts
Latest Ruby Buzz Posts by Dave Hoover
Latest Posts From Red Squirrel Reflections
Advertisement
Inspired by Jamis' post on assert_select I've just committed an update to my Watir on Rails plugin that adds support for both assert_select and assert_tag . Give it a try!
require File.dirname(__FILE__) + '/../test_helper'
class GettingStartedTest < Test::Unit::TestCase
include WatirOnRails
def test_getting_started
browser = open_browser("/")
assert_select "div#getting-started h1", "Getting started"
assert_tag :tag => "h1", :content => "Getting started",
:parent => { :tag => "div", :attributes => { :id => "getting-started"} }
end
end
Rather than asserting against the body of the response from the controller, I'm grabbing the HTML from the most recently opened browser.
Read: assert_select for Watir