class CRB::Console

Public Instance Methods

execute!() click to toggle source
# File lib/crb.rb, line 97
def execute!
  load_step_definitions
  IRB.setup(__FILE__)
  IRB.conf[:CONTEXT_MODE] = 0
  irb = Irb.new(WorkSpace.new(world))
  IRB.module_eval do
    @CONF[:MAIN_CONTEXT] = irb.context
  end

  trap("SIGINT") {
    world.before 
    irb.signal_handle
  }
  catch(:IRB_EXIT) do
    irb.eval_input
  end
end
load_step_definitions() click to toggle source
# File lib/crb.rb, line 92
def load_step_definitions
  files = configuration.support_to_load + configuration.step_defs_to_load
  support.load_files!(files)
end
rb() click to toggle source
# File lib/crb.rb, line 70
def rb
  @rb ||= support.load_programming_language('rb')
end
support() click to toggle source
# File lib/crb.rb, line 66
def support
  @support ||= Cucumber::Runtime::SupportCode.new(configuration)
end
world() click to toggle source
# File lib/crb.rb, line 74
def world
  @world ||= (
    stub = Struct.new(:language).new # stub scenario
    rb.begin_rb_scenario(stub)
    world = rb.current_world
    world.extend(CRB::World)
    world.support = support
    world.rb = rb
    world.instance_eval do
      Gherkin::I18n.code_keywords.each do |adverb|
        next if adverb.to_s == "Given"
        alias :"#{adverb}" :Given
      end
    end
    world
  )
end