Dashboard > Watir > ... > Tutorial > RSpec
Watir Log In View a printable version of the current page.
RSpec
Added by Zeljko, last edited by Zeljko on Apr 02, 2008  (view change) show comment
Labels: 
(None)

RSpec

This is the simplest usage of Watir and RSpec that I could think of. Before you use this code you should install RSpec. The easiest way it to type

gem install rspec
in command prompt. Detailed installation instructions are at RSpec site. O'Reilly has a good tutorial on RSpec.

require 'spec'
require 'watir'

describe "Google home page" do
  it "should find text About Google" do
    browser = Watir::IE.start "http://www.google.com" 
    browser.text.include?("About Google").should == true
  end
end

If you run this code, you should see something like this.

C:\Documents and Settings\limited\Desktop\branches_rspec>rspec.rb
.

Finished in 1.688 seconds

1 example, 0 failures
Go to contents, previous, next page.

Site running on a free Atlassian Confluence Community License granted to OpenQA. Evaluate Confluence today.
Powered by Atlassian Confluence, the Enterprise Wiki. (Version: 2.5.6 Build:#812 Aug 06, 2007) - Bug/feature request - Contact Administrators