module Cucumber::Glue::Dsl
def After(*tag_expressions, name: nil, &proc)
Registers a proc that will run after each Scenario. You can register as many
def After(*tag_expressions, name: nil, &proc) Dsl.register_rb_hook('after', tag_expressions, proc, name: name) end
def AfterAll(name: nil, &proc)
Registers a proc that will run after the execution of the scenarios.
def AfterAll(name: nil, &proc) Dsl.register_rb_hook('after_all', [], proc, name: name) end
def AfterStep(*tag_expressions, name: nil, &proc)
Registers a proc that will run after each Step. You can register as
def AfterStep(*tag_expressions, name: nil, &proc) Dsl.register_rb_hook('after_step', tag_expressions, proc, name: name) end
def Around(*tag_expressions, name: nil, &proc)
blocks in 1.8), on which it should call the .call method. You can register
argument (but passed as a regular argument, since blocks cannot accept
should accept two arguments: two arguments: the scenario and a "block"
Registers a proc that will be wrapped around each scenario. The proc
def Around(*tag_expressions, name: nil, &proc) Dsl.register_rb_hook('around', tag_expressions, proc, name: name) end
def Before(*tag_expressions, name: nil, &proc)
Registers a proc that will run before each Scenario. You can register as many
def Before(*tag_expressions, name: nil, &proc) Dsl.register_rb_hook('before', tag_expressions, proc, name: name) end
def BeforeAll(name: nil, &proc)
Registers a proc that will run before the execution of the scenarios.
def BeforeAll(name: nil, &proc) Dsl.register_rb_hook('before_all', [], proc, name: name) end
def InstallPlugin(name: nil, &proc)
def InstallPlugin(name: nil, &proc) Dsl.register_rb_hook('install_plugin', [], proc, name: name) end
def ParameterType(options)
def ParameterType(options) type = options[:type] || Object use_for_snippets = if_nil(options[:use_for_snippets], true) prefer_for_regexp_match = if_nil(options[:prefer_for_regexp_match], false) parameter_type = CucumberExpressions::ParameterType.new( options[:name], options[:regexp], type, options[:transformer], use_for_snippets, prefer_for_regexp_match ) Dsl.define_parameter_type(parameter_type) end
def World(*world_modules, **namespaced_world_modules, &proc)
World(my_module: MyModule)
World(MyModule)
end
MyClass.new
World do
Cucumber will not yield anything to the +proc+. Examples:
one Proc you will get an error.
like (to register more modules), but if you try to register more than
features/support. You can call this method as many times as you
This method is typically called from one or more Ruby scripts under
symbols are the namespaces.
possible to create a namespaced World by using an hash, where the
By default the +world modules+ are added to a global namespace. It is
will be mixed into this Object (via Object#extend).
Object that the scenario's steps will run within. Any +world_modules+
The +proc+ will be executed once before each scenario to create an
Registers any number of +world_modules+ (Ruby Modules) and/or a Proc.
def World(*world_modules, **namespaced_world_modules, &proc) Dsl.build_rb_world_factory(world_modules, namespaced_world_modules, proc) end
def alias_adverb(adverb)
def alias_adverb(adverb) alias_method adverb, :register_rb_step_definition end
def build_rb_world_factory(world_modules, namespaced_world_modules, proc)
def build_rb_world_factory(world_modules, namespaced_world_modules, proc) @rb_language.build_rb_world_factory(world_modules, namespaced_world_modules, proc) end
def define_parameter_type(parameter_type)
def define_parameter_type(parameter_type) @rb_language.define_parameter_type(parameter_type) end
def if_nil(value, default)
def if_nil(value, default) value.nil? ? default : value end
def register_rb_hook(phase, tag_names, proc, name: nil)
def register_rb_hook(phase, tag_names, proc, name: nil) @rb_language.register_rb_hook(phase, tag_names, proc, name: name) end
def register_rb_step_definition(regexp, proc_or_sym, options = {})
def register_rb_step_definition(regexp, proc_or_sym, options = {}) @rb_language.register_rb_step_definition(regexp, proc_or_sym, options) end
def register_rb_step_definition(regexp, symbol = nil, options = {}, &proc)
If no +symbol+ if provided then the +&proc+ gets executed in
and then sent the +symbol+.
will be executed in the context of the World object
key, the value for this is assumed to be a proc. This proc
that scenario. If the +options+ hash contains an :on
for each scenario and is shared across step definitions within
as defined by #World. A new World object is created
If provided, the +symbol+ is sent to the World object
new language is loaded.
also to the i18n translations whenever a feature of a
to Given, When and Then, and
Registers a new Ruby StepDefinition. This method is aliased
def register_rb_step_definition(regexp, symbol = nil, options = {}, &proc) proc_or_sym = symbol || proc Dsl.register_rb_step_definition(regexp, proc_or_sym, options) end