Created
April 22, 2013 20:59
-
-
Save TXDynamics/5438496 to your computer and use it in GitHub Desktop.
Rspec test shortened by naming the subject
and using a pre-visit
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# My first application test file using RSPEC and Capybara | |
# Here at the top we are defining the subject which is just pages. | |
# pages is the normal object that we would call before like pages.have_content | |
require 'spec_helper' | |
describe "Static pages" do | |
subject { page } | |
describe "Home page" do | |
before {visit root_path} | |
it {should have_content('Sample App')} | |
it {should have_selector('title',text: full_title('') )} | |
end | |
describe "Help page" do | |
before {visit help_path} | |
it {should have_content('Help')} | |
it {should have_selector('title', text: full_title('Help'))} | |
end | |
describe "About_page" do | |
before { visit about_path} | |
it {should have_content('About Us')} | |
it {should have_selector('title', text: full_title('About'))} | |
end | |
describe "Contact Page" do | |
before {visit contact_path} | |
it {should have_selector('h1', text: 'Contact')} | |
it {should have_selector('title', text: full_title('Contact'))} | |
end | |
end | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment