class Cucumber::JsSupport::JsLanguage
def add_step_definition(regexp, js_function)
def add_step_definition(regexp, js_function) @step_definitions << JsStepDefinition.new(self, regexp, js_function) end
def alias_adverbs(adverbs)
def alias_adverbs(adverbs) end
def begin_scenario(scenario)
def begin_scenario(scenario) @language = scenario.language end
def current_world
def current_world @world end
def end_scenario
def end_scenario end
def execute_step_definition(name, multiline_argument = nil)
def execute_step_definition(name, multiline_argument = nil) @runtime.step_match(name).invoke(multiline_argument) end
def initialize(runtime)
def initialize(runtime) @step_definitions = [] @world = JsWorld.new @runtime = runtime @world["jsLanguage"] = self @world.load(File.dirname(__FILE__) + '/js_dsl.js') end
def load_code_file(js_file)
def load_code_file(js_file) @world.load(js_file) end
def path_to_load_js_from
def path_to_load_js_from paths = @runtime.features_paths if paths.empty? '' # Using rake else path = paths[0][/(^.*\/?features)/, 0] path ? "#{path}/../" : '../' end end
def register_js_hook(phase, tag_expressions, js_function)
def register_js_hook(phase, tag_expressions, js_function) add_hook(phase, JsHook.new(self, tag_expressions, js_function)) end
def register_js_transform(regexp, js_function)
def register_js_transform(regexp, js_function) add_transform(JsTransform.new(self, regexp, js_function)) end
def step_matches(name_to_match, name_to_format)
def step_matches(name_to_match, name_to_format) @step_definitions.map do |step_definition| if(arguments = step_definition.arguments_from(name_to_match)) StepMatch.new(step_definition, name_to_match, name_to_format, arguments) else nil end end.compact end
def steps(steps_text, file_colon_line)
def steps(steps_text, file_colon_line) @runtime.invoke_steps(steps_text, @language, file_colon_line) end
def world(js_files)
def world(js_files) js_files.each do |js_file| load_code_file("#{path_to_load_js_from}#{js_file}") end end