Created
October 6, 2011 14:55
-
-
Save bernd/1267601 to your computer and use it in GitHub Desktop.
Simple test with a capybara server.
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 'open-uri' | |
require 'capybara/rspec' | |
app = lambda do |env| | |
[200, {'Content-Type' => 'text/plain'}, ['Hello rat!']] | |
end | |
Capybara.app = app | |
server = Capybara::Server.new(Capybara.app).boot | |
url = "http://#{server.host}:#{server.port}" | |
puts "Server started. (#{url})" | |
describe "test local server" do | |
it "returns 'Hello rat!'" do | |
open(url).read.should =~ %r{Hello rat!} | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Execute with 'rspec capy-test.rb'