Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Remove culerity and celerity drivers

  • Loading branch information...
commit 5c4f28ec615d6195f74180c69ca00196f6f400a0 1 parent 47dbcdf
@sobrinho sobrinho authored
View
2  capybara.gemspec
@@ -24,8 +24,6 @@ Gem::Specification.new do |s|
s.add_runtime_dependency("nokogiri", [">= 1.3.3"])
s.add_runtime_dependency("mime-types", [">= 1.16"])
- s.add_runtime_dependency("culerity", [">= 0.2.4"])
- s.add_runtime_dependency("celerity", [">= 0.7.9"])
s.add_runtime_dependency("selenium-webdriver", [">= 0.0.27"])
s.add_runtime_dependency("rack", [">= 1.0.0"])
s.add_runtime_dependency("rack-test", [">= 0.5.4"])
View
10 lib/capybara.rb
@@ -200,8 +200,6 @@ module Driver
autoload :Base, 'capybara/driver/base'
autoload :Node, 'capybara/driver/node'
autoload :RackTest, 'capybara/driver/rack_test_driver'
- autoload :Celerity, 'capybara/driver/celerity_driver'
- autoload :Culerity, 'capybara/driver/culerity_driver'
autoload :Selenium, 'capybara/driver/selenium_driver'
end
end
@@ -220,14 +218,6 @@ module Driver
Capybara::Driver::RackTest.new(app)
end
-Capybara.register_driver :celerity do |app|
- Capybara::Driver::Celerity.new(app)
-end
-
-Capybara.register_driver :culerity do |app|
- Capybara::Driver::Culerity.new(app)
-end
-
Capybara.register_driver :selenium do |app|
Capybara::Driver::Selenium.new(app)
end
View
164 lib/capybara/driver/celerity_driver.rb
@@ -1,164 +0,0 @@
-class Capybara::Driver::Celerity < Capybara::Driver::Base
- class Node < Capybara::Driver::Node
- def text
- native.text
- end
-
- def [](name)
- value = native.attribute_value(name.to_sym)
- return value if value and not value.to_s.empty?
- end
-
- def value
- if tag_name == "select" and native.multiple?
- find(".//option[@selected]").map { |n| if n.has_value? then n.value else n.text end }
- else
- native.value
- end
- end
-
- def set(value)
- native.set(value)
- end
-
- def select_option
- native.click
- end
-
- def unselect_option
- unless select_node.native.multiple?
- raise Capybara::UnselectNotAllowed, "Cannot unselect option from single select box."
- end
-
- # FIXME: couldn't find a clean way to unselect, so clear and reselect
- selected_nodes = select_node.find('.//option[@selected]')
- select_node.native.clear
- selected_nodes.each { |n| n.click unless n.path == path }
- end
-
- def click
- native.click
- end
-
- def drag_to(element)
- native.fire_event('mousedown')
- element.native.fire_event('mousemove')
- element.native.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...
- native.to_xml[/^\s*<([a-z0-9\-\:]+)/, 1]
- end
-
- def visible?
- native.visible?
- end
-
- def checked?
- native.checked?
- rescue # https://github.com/langalex/culerity/issues/issue/33
- false
- end
-
- def selected?
- native.selected?
- rescue # https://github.com/langalex/culerity/issues/issue/33
- false
- end
-
- def path
- native.xpath
- end
-
- def trigger(event)
- native.fire_event(event.to_s)
- end
-
- def find(locator)
- noko_node = Nokogiri::HTML(driver.body).xpath(native.xpath).first
- all_nodes = noko_node.xpath(locator).map { |n| n.path }.join(' | ')
- if all_nodes.empty? then [] else driver.find(all_nodes) end
- end
-
- protected
-
- # a reference to the select node if this is an option node
- def select_node
- find('./ancestor::select').first
- end
-
- def has_value?
- native.object.hasAttribute('value')
- end
- end
-
- attr_reader :app, :rack_server, :options
-
- def initialize(app, options={})
- @app = app
- @options = options
- @rack_server = Capybara::Server.new(@app)
- @rack_server.boot if Capybara.run_server
- end
-
- def visit(path)
- browser.goto(url(path))
- end
-
- def current_url
- browser.url
- end
-
- def source
- browser.html
- end
-
- def body
- browser.document.as_xml
- end
-
- def response_headers
- browser.response_headers
- end
-
- def status_code
- browser.status_code
- end
-
- def find(selector)
- browser.elements_by_xpath(selector).map { |node| Node.new(self, node) }
- end
-
- def wait?; true; end
-
- def execute_script(script)
- browser.execute_script script
- nil
- end
-
- def evaluate_script(script)
- browser.execute_script "#{script}"
- end
-
- def browser
- unless @_browser
- require 'celerity'
- @_browser = ::Celerity::Browser.new(options)
- end
-
- @_browser
- end
-
- def reset!
- browser.clear_cookies
- end
-
-private
-
- def url(path)
- rack_server.url(path)
- end
-
-end
View
26 lib/capybara/driver/culerity_driver.rb
@@ -1,26 +0,0 @@
-require 'culerity'
-
-class Capybara::Driver::Culerity < Capybara::Driver::Celerity
-
- def self.server
- unless @_server
- @_server = ::Culerity::run_server
- at_exit do
- @_server.close
- end
- end
- @_server
- end
-
- def browser
- unless @_browser
- @_browser = ::Culerity::RemoteBrowserProxy.new self.class.server, options
- at_exit do
- @_browser.close
- @_browser.exit
- end
- end
- @_browser
- end
-
-end
View
13 spec/driver/celerity_driver_spec.rb
@@ -1,13 +0,0 @@
-require 'spec_helper'
-
-describe Capybara::Driver::Celerity, :jruby => :platform do
- before(:all) do
- @driver = TestSessions::Celerity.driver
- end
-
- it_should_behave_like "driver"
- it_should_behave_like "driver with javascript support"
- it_should_behave_like "driver with header support"
- it_should_behave_like "driver with status code support"
- it_should_behave_like "driver with cookies support"
-end
View
14 spec/driver/culerity_driver_spec.rb
@@ -1,14 +0,0 @@
-require 'spec_helper'
-
-describe Capybara::Driver::Culerity, :jruby => :installed do
-
- before(:all) do
- @driver = TestSessions::Culerity.driver
- end
-
- it_should_behave_like "driver"
- it_should_behave_like "driver with javascript support"
- it_should_behave_like "driver with header support"
- it_should_behave_like "driver with status code support"
- it_should_behave_like "driver with cookies support"
-end
View
22 spec/driver/remote_culerity_driver_spec.rb
@@ -1,22 +0,0 @@
-require 'spec_helper'
-
-describe Capybara::Driver::Culerity, :jruby => :installed do
- before(:all) do
- Capybara.app_host = "http://capybara-testapp.heroku.com"
- @driver = TestSessions::Culerity.driver
- end
-
- after(:all) do
- Capybara.app_host = nil
- end
-
- it "should navigate to a fully qualified remote page" do
- @driver.visit('http://capybara-testapp.heroku.com/foo')
- @driver.body.should include('Another World')
- end
-
- it_should_behave_like "driver"
- it_should_behave_like "driver with javascript support"
- it_should_behave_like "driver with header support"
- it_should_behave_like "driver with status code support"
-end
View
24 spec/session/celerity_session_spec.rb
@@ -1,24 +0,0 @@
-require 'spec_helper'
-
-describe Capybara::Driver::Celerity, :jruby => :platform do
- before(:all) do
- @session = TestSessions::Celerity
- end
-
- describe '#driver' do
- it "should be a celerity driver" do
- @session.driver.should be_an_instance_of(Capybara::Driver::Celerity)
- end
- end
-
- describe '#mode' do
- it "should remember the mode" do
- @session.mode.should == :celerity
- end
- end
-
- it_should_behave_like "session"
- it_should_behave_like "session with javascript support"
- it_should_behave_like "session with headers support"
- it_should_behave_like "session with status code support"
-end
View
26 spec/session/culerity_session_spec.rb
@@ -1,26 +0,0 @@
-require 'spec_helper'
-
-describe Capybara::Session, :jruby => :installed do
- context 'with culerity driver' do
- before(:all) do
- @session = TestSessions::Culerity
- end
-
- describe '#driver' do
- it "should be a culerity 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"
- it_should_behave_like "session with status code support"
- end
-end
View
14 spec/spec_helper.rb
@@ -15,23 +15,9 @@
module TestSessions
RackTest = Capybara::Session.new(:rack_test, TestApp)
Selenium = Capybara::Session.new(:selenium, TestApp)
- Culerity = Capybara::Session.new(:culerity, TestApp)
- Celerity = Capybara::Session.new(:celerity, TestApp)
end
RSpec.configure do |config|
-
- running_with_jruby = RUBY_PLATFORM =~ /java/
- jruby_installed = `which jruby` && $?.success?
-
- warn "** Skipping Celerity specs because platform is not Java" unless running_with_jruby
- warn "** Skipping Culerity specs because JRuby is not installed" unless jruby_installed
-
- config.filter_run_excluding(:jruby => lambda { |value|
- return true if value == :platform && !running_with_jruby
- return true if value == :installed && !jruby_installed
- })
-
config.before do
Capybara.configure do |config|
config.default_selector = :xpath
Please sign in to comment.
Something went wrong with that request. Please try again.