Sha256: 34f319029de96c4313673f270fc4f0566c5203379c3f4f3b780c600ef22eea32
Contents?: true
Size: 1.58 KB
Versions: 1
Compression:
Stored size: 1.58 KB
Contents
require File.expand_path('spec_helper', File.dirname(__FILE__)) describe Capybara::Server do it "should spool up a rack server" do @app = proc { |env| [200, {}, "Hello Server!"]} @server = Capybara::Server.new(@app) @res = Net::HTTP.start(@server.host, @server.port) { |http| http.get('/') } @res.body.should include('Hello Server') end it "should find an available port" do @app1 = proc { |env| [200, {}, "Hello Server!"]} @app2 = proc { |env| [200, {}, "Hello Second Server!"]} @server1 = Capybara::Server.new(@app1) @server2 = Capybara::Server.new(@app2) @res1 = Net::HTTP.start(@server1.host, @server1.port) { |http| http.get('/') } @res1.body.should include('Hello Server') @res2 = Net::HTTP.start(@server2.host, @server2.port) { |http| http.get('/') } @res2.body.should include('Hello Second Server') end it "should use the server if it already running" do @app1 = proc { |env| [200, {}, "Hello Server!"]} @app2 = proc { |env| [200, {}, "Hello Second Server!"]} @server1a = Capybara::Server.new(@app1) @server1b = Capybara::Server.new(@app1) @server2a = Capybara::Server.new(@app2) @server2b = Capybara::Server.new(@app2) @res1 = Net::HTTP.start(@server1b.host, @server1b.port) { |http| http.get('/') } @res1.body.should include('Hello Server') @res2 = Net::HTTP.start(@server2b.host, @server2b.port) { |http| http.get('/') } @res2.body.should include('Hello Second Server') @server1a.port.should == @server1b.port @server2a.port.should == @server2b.port end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
capybara-0.3.0 | spec/server_spec.rb |