Class Index [+]

Quicksearch

Cucumber::RbSupport::RbDsl

This module defines the methods you can use to define pure Ruby Step Definitions and Hooks. This module is mixed into the toplevel object.

Attributes

rb_language[W]

Public Class Methods

alias_adverb(adverb) click to toggle source
    # File lib/cucumber/rb_support/rb_dsl.rb, line 10
10:         def alias_adverb(adverb)
11:           alias_method adverb, :register_rb_step_definition
12:         end
build_rb_world_factory(world_modules, proc) click to toggle source
    # File lib/cucumber/rb_support/rb_dsl.rb, line 14
14:         def build_rb_world_factory(world_modules, proc)
15:           @rb_language.build_rb_world_factory(world_modules, proc)
16:         end
register_rb_hook(phase, tag_names, proc) click to toggle source
    # File lib/cucumber/rb_support/rb_dsl.rb, line 18
18:         def register_rb_hook(phase, tag_names, proc)
19:           @rb_language.register_rb_hook(phase, tag_names, proc)
20:         end
register_rb_step_definition(regexp, proc) click to toggle source
    # File lib/cucumber/rb_support/rb_dsl.rb, line 26
26:         def register_rb_step_definition(regexp, proc)
27:           @rb_language.register_rb_step_definition(regexp, proc)
28:         end
register_rb_transform(regexp, proc) click to toggle source
    # File lib/cucumber/rb_support/rb_dsl.rb, line 22
22:         def register_rb_transform(regexp, proc)
23:           @rb_language.register_rb_transform(regexp, proc)          
24:         end

Public Instance Methods

After(*tag_expressions, &proc) click to toggle source

Registers a proc that will run after each Scenario. You can register as many as you want (typically from ruby scripts under support/hooks.rb).

    # File lib/cucumber/rb_support/rb_dsl.rb, line 61
61:       def After(*tag_expressions, &proc)
62:         RbDsl.register_rb_hook('after', tag_expressions, proc)
63:       end
AfterConfiguration(&proc) click to toggle source

Registers a proc that will run after Cucumber is configured. You can register as as you want (typically from ruby scripts under support/hooks.rb).

    # File lib/cucumber/rb_support/rb_dsl.rb, line 91
91:       def AfterConfiguration(&proc)
92:         RbDsl.register_rb_hook('after_configuration', [], proc)
93:       end
AfterStep(*tag_expressions, &proc) click to toggle source

Registers a proc that will run after each Step. You can register as as you want (typically from ruby scripts under support/hooks.rb).

    # File lib/cucumber/rb_support/rb_dsl.rb, line 76
76:       def AfterStep(*tag_expressions, &proc)
77:         RbDsl.register_rb_hook('after_step', tag_expressions, proc)
78:       end
Around(*tag_expressions, &proc) click to toggle source

Registers a proc that will be wrapped around each scenario. The proc should accept two arguments: two arguments: the scenario and a “block” argument (but passed as a regular argument, since blocks cannot accept blocks in 1.8), on which it should call the .call method. You can register as many as you want (typically from ruby scripts under support/hooks.rb).

    # File lib/cucumber/rb_support/rb_dsl.rb, line 70
70:       def Around(*tag_expressions, &proc)
71:         RbDsl.register_rb_hook('around', tag_expressions, proc)
72:       end
Before(*tag_expressions, &proc) click to toggle source

Registers a proc that will run before each Scenario. You can register as many as you want (typically from ruby scripts under support/hooks.rb).

    # File lib/cucumber/rb_support/rb_dsl.rb, line 55
55:       def Before(*tag_expressions, &proc)
56:         RbDsl.register_rb_hook('before', tag_expressions, proc)
57:       end
Transform(regexp, &proc) click to toggle source

Registers a proc that will be called with a step definition argument if it matches the pattern passed as the first argument to Transform. Alternatively, if the pattern contains captures then they will be yielded as arguments to the provided proc. The return value of the proc is consequently yielded to the step definition.

    # File lib/cucumber/rb_support/rb_dsl.rb, line 85
85:       def Transform(regexp, &proc)
86:         RbDsl.register_rb_transform(regexp, proc)
87:       end
World(*world_modules, &proc) click to toggle source

Registers any number of world_modules (Ruby Modules) and/or a Proc. The proc will be executed once before each scenario to create an Object that the scenario’s steps will run within. Any world_modules will be mixed into this Object (via Object#extend).

This method is typically called from one or more Ruby scripts under features/support. You can call this method as many times as you like (to register more modules), but if you try to register more than one Proc you will get an error.

Cucumber will not yield anything to the proc. Examples:

   World do
     MyClass.new
   end

   World(MyModule)
    # File lib/cucumber/rb_support/rb_dsl.rb, line 49
49:       def World(*world_modules, &proc)
50:         RbDsl.build_rb_world_factory(world_modules, proc)
51:       end
register_rb_step_definition(regexp, &proc) click to toggle source

Registers a new Ruby StepDefinition. This method is aliased to Given, When and Then, and also to the i18n translations whenever a feature of a new language is loaded.

The +&proc+ gets executed in the context of a World object, which is defined by #World. A new World object is created for each scenario and is shared across step definitions within that scenario.

     # File lib/cucumber/rb_support/rb_dsl.rb, line 104
104:       def register_rb_step_definition(regexp, &proc)
105:         RbDsl.register_rb_step_definition(regexp, proc)
106:       end

Disabled; run with --debug to generate this.

[Validate]

Generated with the Darkfish Rdoc Generator 1.1.6.