1
0
Fork 0
mirror of https://github.com/teamcapybara/capybara.git synced 2022-11-09 12:08:07 -05:00

Reconciling latest changes to culerity_driver to celerity_driver

This commit is contained in:
Lenny Marks 2009-12-17 23:41:22 -05:00
parent 1604046fe7
commit 4fae6a4a86
3 changed files with 3 additions and 101 deletions

View file

@ -1,98 +0,0 @@
require 'culerity'
class Capybara::Driver::Culerity < Capybara::Driver::Base
class Node < Capybara::Node
def text
node.text
end
def [](name)
value = if name.to_sym == :class
node.class_name
else
node.send(name.to_sym)
end
return value if value and not value.empty?
end
def set(value)
node.set(value)
end
def select(option)
node.select(option)
end
def click
node.click
end
def drag_to(element)
node.fire_event('mousedown')
element.node.fire_event('mousemove')
element.node.fire_event('mouseup')
end
def tag_name
# FIXME: this might be the dumbest way ever of getting the tag name
# there has to be something better...
node.to_xml[/^\s*<([a-z0-9\-\:]+)/, 1]
end
end
attr_reader :app, :rack_server
def self.server
unless @_server
@_server = ::Culerity::run_server
at_exit do
@_server.close
end
end
@_server
end
def initialize(app)
@app = app
@rack_server = Capybara::Server.new(@app)
end
def visit(path)
browser.goto(url(path))
end
def body
browser.html
end
def current_url
browser.url
end
def find(selector)
browser.elements_by_xpath(selector).map { |node| Node.new(self, node) }
end
def wait?; true; end
def evaluate_script(script)
browser.execute_script "#{script}"
end
private
def url(path)
rack_server.url(path)
end
def browser
unless @_browser
@_browser = ::Culerity::RemoteBrowserProxy.new self.class.server, {:browser => :firefox, :log_level => :off}
at_exit do
@_browser.exit
end
end
@_browser
end
end

View file

@ -1,8 +1,8 @@
require File.expand_path('../spec_helper', File.dirname(__FILE__))
describe Capybara::Driver::Culerity do
describe Capybara::Driver::Celerity do
before do
@driver = Capybara::Driver::Culerity.new(TestApp)
@driver = Capybara::Driver::Celerity.new(TestApp)
end
it_should_behave_like "driver"

View file

@ -8,7 +8,7 @@ describe Capybara::Session do
describe '#driver' do
it "should be a rack test driver" do
@session.driver.should be_an_instance_of(Capybara::Driver::Culerity)
@session.driver.should be_an_instance_of(Capybara::Driver::Celerity)
end
end