Skip to content

Instantly share code, notes, and snippets.

@rjurado01
Forked from jgwhite/Gemfile
Created January 17, 2017 19:59
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 rjurado01/6be93fafd0cd4d12f89660371d1ef7bb to your computer and use it in GitHub Desktop.
Save rjurado01/6be93fafd0cd4d12f89660371d1ef7bb to your computer and use it in GitHub Desktop.
Testing Static HTML with RSpec & Capybara
<!doctype html>
<html>
<head>
<title>Example</title>
</head>
<body>
<h1>Hello World!</h1>
</body>
</html>
require 'bundler/setup'
require 'rack/file'
require 'capybara/rspec'
Capybara.app = Rack::File.new File.dirname __FILE__
describe "Example page", :type => :request do
it "contains an H1 with text 'Hello World!'" do
visit '/example.html'
page.should have_css 'h1', :text => 'Hello World!'
end
end
source :rubygems
gem 'capybara'
gem 'rack'
gem 'rspec'
bundle exec rspec example_spec.rb --color --format=documentation
gem install bundler
bundle
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment