Skip to content

Instantly share code, notes, and snippets.

@wheresalice
Created April 8, 2010 15:14
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save wheresalice/360169 to your computer and use it in GitHub Desktop.
Save wheresalice/360169 to your computer and use it in GitHub Desktop.
rspec file to check the basics of a Drupal site
require 'rubygems'
require 'watir'
require 'spec'
Watir::Browser.default = 'firefox'
describe "test Drupal frontend" do
before(:each) do
@browser ||= Watir::Browser.new
@domain ||= 'example.org'
@http ||= 'http'
end
describe "that anonymous users can't run update.php" do
it "should return Access denied" do
@browser.goto(@http + '://' + @domain + '/update.php')
@browser.text.should include('Access denied')
end
end
describe "that the frontpage shouldn't show warnings or errors" do # the describe() is an example group
it "shouldn't show warnings" do # the it() represents the detail that will be expressed in the code within the block
@browser.goto(@http + '://' + @domain)
@browser.text.should_not include('warning:')
end
it "shouldn't show errors" do
@browser.goto(@http + '://' + @domain)
@browser.text.should_not include('error:')
end
end
after(:each) do
@browser.close unless @browser.nil?
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment