-
-
Save rjurado01/6be93fafd0cd4d12f89660371d1ef7bb to your computer and use it in GitHub Desktop.
Testing Static HTML with RSpec & Capybara
This file contains hidden or 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
<!doctype html> | |
<html> | |
<head> | |
<title>Example</title> | |
</head> | |
<body> | |
<h1>Hello World!</h1> | |
</body> | |
</html> |
This file contains hidden or 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
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 |
This file contains hidden or 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
source :rubygems | |
gem 'capybara' | |
gem 'rack' | |
gem 'rspec' |
This file contains hidden or 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
bundle exec rspec example_spec.rb --color --format=documentation |
This file contains hidden or 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
gem install bundler | |
bundle |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment