Skip to content

Instantly share code, notes, and snippets.

@oseifrimpong
Created September 1, 2013 23:20
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 oseifrimpong/6407964 to your computer and use it in GitHub Desktop.
Save oseifrimpong/6407964 to your computer and use it in GitHub Desktop.
1) User Pages signup page
Failure/Error: it { should have_selector('title', text: full_title('Sign up'))}
expected #has_selector?("title", {:text=>"Ruby on Rails Tutorial Sample App | Sign up"}) to return true, got false
# ./spec/requests/user_pages_spec.rb:12:in `block (3 levels) in <top (required)>'
2) Static pages Home page it should behave like all static pages
Failure/Error: it { should have_selector('title', content: full_title(page_title)) }
ArgumentError:
invalid keys :content, should be one of :text, :visible, :between, :count, :maximum, :minimum
Shared Example Group: "all static pages" called from ./spec/requests/static_pages_spec.rb:18
# ./spec/requests/static_pages_spec.rb:11:in `block (3 levels) in <top (required)>'
3) Static pages Help page
Failure/Error: it { should_not have_selector 'title', text: '| Help'}
expected #has_selector?("title", {:text=>"| Help"}) to return false, got true
# ./spec/requests/static_pages_spec.rb:28:in `block (3 levels) in <top (required)>'
4) Static pages Help page it should behave like all static pages
Failure/Error: it { should have_selector('title', content: full_title(page_title)) }
ArgumentError:
invalid keys :content, should be one of :text, :visible, :between, :count, :maximum, :minimum
Shared Example Group: "all static pages" called from ./spec/requests/static_pages_spec.rb:27
# ./spec/requests/static_pages_spec.rb:11:in `block (3 levels) in <top (required)>'
5) Static pages About page
Failure/Error: it { should_not have_selector 'title', text: '| About Us'}
expected #has_selector?("title", {:text=>"| About Us"}) to return false, got true
# ./spec/requests/static_pages_spec.rb:37:in `block (3 levels) in <top (required)>'
6) Static pages About page it should behave like all static pages
Failure/Error: it { should have_selector('title', content: full_title(page_title)) }
NameError:
undefined local variable or method `page_title' for #<RSpec::Core::ExampleGroup::Nested_3::Nested_3::Nested_1:0xacaaef4>
Shared Example Group: "all static pages" called from ./spec/requests/static_pages_spec.rb:36
# ./spec/requests/static_pages_spec.rb:11:in `block (3 levels) in <top (required)>'
7) Static pages Contact page should have the right links on the layout
Failure/Error: page.should have_selector 'title', text: full_title('Contact')
expected #has_selector?("title", {:text=>"Ruby on Rails Tutorial Sample App | Contact"}) to return true, got false
# ./spec/requests/static_pages_spec.rb:57:in `block (3 levels) in <top (required)>'
8) Static pages Contact page it should behave like all static pages
Failure/Error: it { should have_selector('title', content: full_title(page_title)) }
ArgumentError:
invalid keys :content, should be one of :text, :visible, :between, :count, :maximum, :minimum
Shared Example Group: "all static pages" called from ./spec/requests/static_pages_spec.rb:46
# ./spec/requests/static_pages_spec.rb:11:in `block (3 levels) in <top (required)>'
Finished in 1.04 seconds
18 examples, 8 failures
Failed examples:
rspec ./spec/requests/user_pages_spec.rb:12 # User Pages signup page
rspec ./spec/requests/static_pages_spec.rb:11 # Static pages Home page it should behave like all static pages
rspec ./spec/requests/static_pages_spec.rb:28 # Static pages Help page
rspec ./spec/requests/static_pages_spec.rb:11 # Static pages Help page it should behave like all static pages
rspec ./spec/requests/static_pages_spec.rb:37 # Static pages About page
rspec ./spec/requests/static_pages_spec.rb:11 # Static pages About page it should behave like all static pages
rspec ./spec/requests/static_pages_spec.rb:50 # Static pages Contact page should have the right links on the layout
rspec ./spec/requests/static_pages_spec.rb:11 # Static pages Contact page it should behave like all static pages
source 'https://rubygems.org'
gem 'rails', '3.2.3'
gem 'bootstrap-sass', '2.0.0'
gem 'pg', '0.12.2'
group :development, :test do
gem 'sqlite3'
end
# Bundle edge Rails instead:
# gem 'rails', :git => 'git://github.com/rails/rails.git'
group :test do
gem 'rspec-rails', '2.9.0'
gem 'spork', '~> 0.9.0.rc'
end
#group :development do
#gem 'guard-spork'
#end
# Gems used only for assets and not required
# in production environments by default.
group :assets do
gem 'sass-rails', '~> 3.2.3'
gem 'coffee-rails', '~> 3.2.1'
# See https://github.com/sstephenson/execjs#readme for more supported runtimes
# gem 'therubyracer', :platforms => :ruby
gem 'uglifier', '>= 1.0.3'
end
gem 'jquery-rails'
gem 'launchy'
# To use ActiveModel has_secure_password
# gem 'bcrypt-ruby', '~> 3.0.0'
# To use Jbuilder templates for JSON
# gem 'jbuilder'
# Use unicorn as the app server
# gem 'unicorn'
# Deploy with Capistrano
# gem 'capistrano'
# To use debugger
# gem 'debugger'
group :test do
gem 'capybara', '2.0.0'
#gem 'capybara', '1.0.0.beta1'
end
require 'spec_helper'
describe "Static pages" do
include Rails.application.routes.url_helpers
subject{ page }
shared_examples_for "all static pages" do
it { should have_selector('h1', text: heading) }
it { should have_selector('title', content: full_title(page_title)) }
end
describe "Home page" do
before {visit root_path}
let(:heading) { 'Sample App'}
let(:page_title ) { '' }
it_should_behave_like "all static pages"
it { should_not have_selector 'title', text: '| Home'}
end
describe "Help page" do
before {visit help_path}
let(:heading) { 'Help'}
let(:page_title ) { '' }
it_should_behave_like "all static pages"
it { should_not have_selector 'title', text: '| Help'}
end
describe "About page" do
before {visit about_path}
let(:heading) { 'About Us'}
it_should_behave_like "all static pages"
it { should_not have_selector 'title', text: '| About Us'}
end
describe "Contact page" do
before {visit contact_path}
let(:heading) { 'Contact'}
let(:page_title ) { '' }
it_should_behave_like "all static pages"
it { should_not have_selector 'title', text: '| Contact'}
it "should have the right links on the layout" do
visit root_path
click_link "About"
page.should have_selector 'title', text: full_title('About Us')
click_link "Help"
page.should have_selector 'title', text: full_title('Help')
click_link "Contact"
page.should have_selector 'title', text: full_title('Contact')
click_link "Home"
page.should have_selector 'title', text: full_title('Home')
click_link "Sample App"
page.should have_selector 'title', text: full_title('Sample App')
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment