Added specs for running against a remote server
Also fixed an issue with the URL:s
This commit is contained in:
parent
44cf233a8d
commit
d8c8cd6bfb
|
@ -43,7 +43,6 @@ class Capybara::Driver::Celerity < Capybara::Driver::Base
|
|||
def initialize(app)
|
||||
@app = app
|
||||
unless Capybara.app_host
|
||||
Capybara.log("using app host #{Capybara.app_host}")
|
||||
@rack_server = Capybara::Server.new(@app)
|
||||
end
|
||||
end
|
||||
|
@ -77,7 +76,11 @@ class Capybara::Driver::Celerity < Capybara::Driver::Base
|
|||
private
|
||||
|
||||
def url(path)
|
||||
Capybara.app_host || rack_server.url(path)
|
||||
if rack_server
|
||||
rack_server.url(path)
|
||||
else
|
||||
Capybara.app_host.to_s + path
|
||||
end
|
||||
end
|
||||
|
||||
def browser
|
||||
|
|
|
@ -65,7 +65,9 @@ class Capybara::Driver::Selenium < Capybara::Driver::Base
|
|||
|
||||
def initialize(app)
|
||||
@app = app
|
||||
@rack_server = Capybara::Server.new(@app)
|
||||
unless Capybara.app_host
|
||||
@rack_server = Capybara::Server.new(@app)
|
||||
end
|
||||
end
|
||||
|
||||
def visit(path)
|
||||
|
@ -93,7 +95,11 @@ class Capybara::Driver::Selenium < Capybara::Driver::Base
|
|||
private
|
||||
|
||||
def url(path)
|
||||
rack_server.url(path)
|
||||
if rack_server
|
||||
rack_server.url(path)
|
||||
else
|
||||
Capybara.app_host.to_s + path
|
||||
end
|
||||
end
|
||||
|
||||
def driver
|
||||
|
|
|
@ -0,0 +1,33 @@
|
|||
require File.expand_path('../spec_helper', File.dirname(__FILE__))
|
||||
|
||||
describe Capybara::Session do
|
||||
context 'with culerity driver' do
|
||||
before(:all) do
|
||||
Capybara.app_host = "http://capybara-testapp.heroku.com"
|
||||
end
|
||||
|
||||
after(:all) do
|
||||
Capybara.app_host = nil
|
||||
end
|
||||
|
||||
before do
|
||||
@session = Capybara::Session.new(:culerity, TestApp)
|
||||
end
|
||||
|
||||
describe '#driver' do
|
||||
it "should be a rack test driver" do
|
||||
@session.driver.should be_an_instance_of(Capybara::Driver::Culerity)
|
||||
end
|
||||
end
|
||||
|
||||
describe '#mode' do
|
||||
it "should remember the mode" do
|
||||
@session.mode.should == :culerity
|
||||
end
|
||||
end
|
||||
|
||||
it_should_behave_like "session"
|
||||
it_should_behave_like "session with javascript support"
|
||||
it_should_behave_like "session with headers support"
|
||||
end
|
||||
end
|
|
@ -0,0 +1,33 @@
|
|||
require File.expand_path('../spec_helper', File.dirname(__FILE__))
|
||||
|
||||
describe Capybara::Session do
|
||||
context 'with selenium driver on a remote host' do
|
||||
before(:all) do
|
||||
Capybara.app_host = "http://capybara-testapp.heroku.com"
|
||||
end
|
||||
|
||||
after(:all) do
|
||||
Capybara.app_host = nil
|
||||
end
|
||||
|
||||
before do
|
||||
@session = Capybara::Session.new(:selenium, TestApp)
|
||||
end
|
||||
|
||||
describe '#driver' do
|
||||
it "should be a selenium driver" do
|
||||
@session.driver.should be_an_instance_of(Capybara::Driver::Selenium)
|
||||
end
|
||||
end
|
||||
|
||||
describe '#mode' do
|
||||
it "should remember the mode" do
|
||||
@session.mode.should == :selenium
|
||||
end
|
||||
end
|
||||
|
||||
it_should_behave_like "session"
|
||||
it_should_behave_like "session with javascript support"
|
||||
it_should_behave_like "session without headers support"
|
||||
end
|
||||
end
|
Loading…
Reference in New Issue