Sha256: 43cbfbc9bd540768baca5f63191ce0b66375bda791e41694be6ddbd6702683d2

Contents?: true

Size: 955 Bytes

Versions: 2

Compression:

Stored size: 955 Bytes

Contents

def prepare_cucumber_example
  if Cucumber::VERSION >= '3'
    @runtime = Cucumber::Runtime.new
    scenario = double('scenario', :language => 'en', :accept_hook? => true)
    @runtime.send(:begin_scenario, scenario)
    @main = Object.new
    @main.extend(Cucumber::Glue::Dsl)
  else
    @runtime = Cucumber::Runtime.new
    language = support_code.ruby if support_code.respond_to?(:ruby)
    language ||= support_code.load_programming_language('rb')
    language
    scenario = double('scenario', :language => 'en', :accept_hook? => true)
    language.send(:begin_scenario, scenario)
    @world = language.current_world
    @main = Object.new
    @main.extend(Cucumber::RbSupport::RbDsl)
  end
end

def invoke_cucumber_step(step)
  first_step_match(step).invoke(nil) # nil means no multiline args
end

def support_code
  @runtime.instance_variable_get(:@support_code)
end

def first_step_match(*args)
  support_code.send(:step_matches, *args).first
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
cucumber_priority-0.3.1 spec/support/cucumber_helper.rb
cucumber_priority-0.3.0 spec/support/cucumber_helper.rb