Created
January 27, 2011 18:50
-
-
Save paneq/798979 to your computer and use it in GitHub Desktop.
Creating an object with Capybara api and jumping into it.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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