Skip to content

Instantly share code, notes, and snippets.

@aosteraas
Created May 2, 2012 04:15
Show Gist options
  • Save aosteraas/2573593 to your computer and use it in GitHub Desktop.
Save aosteraas/2573593 to your computer and use it in GitHub Desktop.
Rubytest
require 'spec_helper'
describe "Static pages" do
let(:base_title) { "Ruby on Rails Tutorial Sample App" }
describe "Home page" do
it "should have the h1 'Sample App'" do
visit '/static_pages/home'
page.should have_selector('h1', :text => 'Sample App')
end
it "should have the base title" do
visit '/static_pages/home'
page.should have_selector('title',
:text => "Ruby on Rails Tutorial Sample App")
end
it "should not have a custom page title" do
visit '/static_pages/home'
page.should_not have_selector('title', :text => '| Home')
end
end
describe "Help page" do
it "should have the h1 'Help'" do
visit '/static_pages/help'
page.should have_selector('h1', :text => 'Help')
end
it "should have the title 'Help'" do
visit '/static_pages/help'
page.should have_selector('title',
:text => "#{base_title} | Help")
end
end
describe "About page" do
it "should have the h1 'About Us'" do
visit '/static_pages/about'
page.should have_selector('h1', :text => 'About Us')
end
it "should have the title 'About Us'" do
visit '/static_pages/about'
page.should have_selector('title',
:text => "#{base_title} | About Us")
end
end
describe "Contact Page" do
it "should have the title 'Contact'" do
visit '/static_pages/contact'
page.should have_selector ('title'),
:text => "#{base_title} | Contact"
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment