Skip to content

Instantly share code, notes, and snippets.

@paneq
Created January 27, 2011 18:50
Show Gist options
  • Star 4 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save paneq/798979 to your computer and use it in GitHub Desktop.
Save paneq/798979 to your computer and use it in GitHub Desktop.
Creating an object with Capybara api and jumping into it.
#!/usr/bin/env ruby
require 'bundler'
Bundler.setup(:default, :test) if defined?(Bundler)
require "selenium-webdriver"
require 'capybara/dsl'
Capybara.default_driver = :selenium
Capybara.default_selector = :css
Capybara.default_wait_time = 5
CapybaraApi = Object.new
CapybaraApi.extend(Capybara)
require 'irb'
def IRB.start_capybara_console
IRB.setup(__FILE__)
irb = IRB::Irb.new(IRB::WorkSpace.new(CapybaraApi))
@CONF[:IRB_RC].call(irb.context) if @CONF[:IRB_RC]
@CONF[:MAIN_CONTEXT] = irb.context
trap("SIGINT") do
irb.signal_handle
end
begin
catch(:IRB_EXIT) do
irb.eval_input
end
ensure
irb_at_exit
end
end
IRB.start_capybara_console
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment