Skip to content

Instantly share code, notes, and snippets.

@MilanGrubnic70
Created December 24, 2016 00:22
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 MilanGrubnic70/d3ae54f0609f94497552fa93e067175d to your computer and use it in GitHub Desktop.
Save MilanGrubnic70/d3ae54f0609f94497552fa93e067175d to your computer and use it in GitHub Desktop.
RSpec Refactored
require 'spec_helper'
describe "Static pages" do
let(:base_title) {"Ruby on Rails Tutorial Sample App"}
subject { page }
describe "Home page" do
before { visit root_path }
it { should have_selector('h1', text: 'Sample App') }
it { should have_selector('title', text: "#{base_title}")}
it { should have_selector('title', text: full_title(''))} #refactored
it { should_not have_selector('title', text: '| Home')}
# it "should have the content 'Sample App'" do
# page.should have_content('Sample App')
# end
it { should have_content('Sample App')}
# it "should have the base title" do
# page.should have_selector('title', text: "#{base_title}")
# end
it { should have_selector('title', text: "#{base_title}")}
# it "should not have a custom page title" do
# visit root_path
# page.should_not have_selector('title', text: '| Home')
# end
it { should_not have_selector('title', text: '| Home')}
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment