Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Branch: master
Fetching contributors…

Cannot retrieve contributors at this time

110 lines (94 sloc) 3.394 kB
require 'spec_helper'
#page.should have_selector('head title') is only working when no text is specified
describe "Static pages" do
#home is coded like it should be
describe "Home page having application layout" do
it "should have the h1 'Sample App'" do
visit '/static_pages/home'
page.should have_selector('h1', :text => 'Sample App')
end
it "should JUST have the h1 selector" do
visit '/static_pages/home'
page.should have_selector('head title')
end
#fails
it "should have_selector head title 'Home'" do
visit '/static_pages/home'
save_and_open_page
page.should have_selector('head title',
:text => "Ruby on Rails Tutorial Sample App | Home")
end
#fails
it "should have content 'Home'" do
visit '/static_pages/home'
# save_and_open_page
page.should have_content("Ruby on Rails Tutorial Sample App | Home")
end
#fails
it "should have css title 'Home'" do
visit '/static_pages/home'
# save_and_open_page
page.should have_css("title", :text => "Ruby on Rails Tutorial Sample App | Home")
end
end
#help has its layout inside its normal view-file and title inside body-tags instead of head
describe "Help page with layout inside" do
it "should have the h1 'Sample App'" do
visit '/static_pages/help'
page.should have_selector('h1', :text => 'Help')
end
#fails
it "should not have_selector head title " do
visit '/static_pages/help'
save_and_open_page
page.should_not have_selector('head title')
end
#fails
it "should not have_selector head title 'Help'" do
visit '/static_pages/help'
# save_and_open_page
page.should_not have_selector('head title',
:text => "Ruby on Rails Tutorial Sample App | Help")
end
it "should have content 'help'" do
visit '/static_pages/help'
# save_and_open_page
page.should have_content("Ruby on Rails Tutorial Sample App | Help")
end
it "should have css title 'help'" do
visit '/static_pages/help'
# save_and_open_page
page.should have_css("title", :text => "Ruby on Rails Tutorial Sample App | Help")
end
end
#about has its own layout-file with h1-tag above titel-tag but inside head-tag
describe "about page with own layout" do
it "should have the h1 'About Us'" do
visit '/static_pages/about'
page.should have_selector('h1', :text => 'About Us')
end
#fails
it "should JUST have_selector head title " do
visit '/static_pages/about'
save_and_open_page
page.should have_selector('head title')
end
#fails
it "should have_selector head title 'About Us'" do
visit '/static_pages/about'
#save_and_open_page
page.should have_selector('head title',
:text => "Ruby on Rails Tutorial Sample App | About Us")
end
it "should have content 'About Us'" do
visit '/static_pages/about'
# save_and_open_page
page.should have_content("Ruby on Rails Tutorial Sample App | About Us")
end
it "should have css title 'About Us'" do
visit '/static_pages/about'
# save_and_open_page
page.should have_css("title", :text => "Ruby on Rails Tutorial Sample App | About Us")
end
end
end
Jump to Line
Something went wrong with that request. Please try again.