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
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:
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