Module: Cucumber::LanguageSupport::LanguageMethods
- Included in:
- PySupport::PyLanguage, RbSupport::RbLanguage, WireSupport::WireLanguage
- Defined in:
- lib/cucumber/language_support/language_methods.rb
Instance Method Summary collapse
- #add_hook(phase, hook) ⇒ Object
- #add_transform(transform) ⇒ Object
- #after(scenario) ⇒ Object
- #after_configuration(configuration) ⇒ Object
- #available_step_definition(regexp_source, file_colon_line) ⇒ Object
- #before(scenario) ⇒ Object
- #clear_hooks ⇒ Object
- #create_step_match(step_definition, step_name, name_to_report, step_arguments) ⇒ Object
- #execute_after_step(scenario) ⇒ Object
- #execute_transforms(args) ⇒ Object
-
#hooks_for(phase, scenario) ⇒ Object
:nodoc:.
- #invoked_step_definition(regexp_source, file_colon_line) ⇒ Object
- #unmatched_step_definitions ⇒ Object
Instance Method Details
#add_hook(phase, hook) ⇒ Object
40 41 42 43 |
# File 'lib/cucumber/language_support/language_methods.rb', line 40 def add_hook(phase, hook) hooks[phase.to_sym] << hook hook end |
#add_transform(transform) ⇒ Object
49 50 51 52 |
# File 'lib/cucumber/language_support/language_methods.rb', line 49 def add_transform(transform) transforms.unshift transform transform end |
#after(scenario) ⇒ Object
16 17 18 19 |
# File 'lib/cucumber/language_support/language_methods.rb', line 16 def after(scenario) execute_after(scenario) end_scenario end |
#after_configuration(configuration) ⇒ Object
21 22 23 24 25 |
# File 'lib/cucumber/language_support/language_methods.rb', line 21 def after_configuration(configuration) hooks[:after_configuration].each do |hook| hook.invoke('AfterConfiguration', configuration) end end |
#available_step_definition(regexp_source, file_colon_line) ⇒ Object
62 63 64 |
# File 'lib/cucumber/language_support/language_methods.rb', line 62 def available_step_definition(regexp_source, file_colon_line) available_step_definition_hash[StepDefinitionLight.new(regexp_source, file_colon_line)] = nil end |
#before(scenario) ⇒ Object
11 12 13 14 |
# File 'lib/cucumber/language_support/language_methods.rb', line 11 def before(scenario) begin_scenario(scenario) execute_before(scenario) end |
#clear_hooks ⇒ Object
45 46 47 |
# File 'lib/cucumber/language_support/language_methods.rb', line 45 def clear_hooks @hooks = nil end |
#create_step_match(step_definition, step_name, name_to_report, step_arguments) ⇒ Object
7 8 9 |
# File 'lib/cucumber/language_support/language_methods.rb', line 7 def create_step_match(step_definition, step_name, name_to_report, step_arguments) StepMatch.new(step_definition, step_name, name_to_report, step_arguments) end |
#execute_after_step(scenario) ⇒ Object
27 28 29 30 31 |
# File 'lib/cucumber/language_support/language_methods.rb', line 27 def execute_after_step(scenario) hooks_for(:after_step, scenario).each do |hook| invoke(hook, 'AfterStep', scenario, false) end end |
#execute_transforms(args) ⇒ Object
33 34 35 36 37 38 |
# File 'lib/cucumber/language_support/language_methods.rb', line 33 def execute_transforms(args) args.map do |arg| matching_transform = transforms.detect {|transform| transform.match(arg) } matching_transform ? matching_transform.invoke(arg) : arg end end |
#hooks_for(phase, scenario) ⇒ Object
:nodoc:
54 55 56 |
# File 'lib/cucumber/language_support/language_methods.rb', line 54 def hooks_for(phase, scenario) #:nodoc: hooks[phase.to_sym].select{|hook| scenario.accept_hook?(hook)} end |
#invoked_step_definition(regexp_source, file_colon_line) ⇒ Object
66 67 68 |
# File 'lib/cucumber/language_support/language_methods.rb', line 66 def invoked_step_definition(regexp_source, file_colon_line) invoked_step_definition_hash[StepDefinitionLight.new(regexp_source, file_colon_line)] = nil end |
#unmatched_step_definitions ⇒ Object
58 59 60 |
# File 'lib/cucumber/language_support/language_methods.rb', line 58 def unmatched_step_definitions available_step_definition_hash.keys - invoked_step_definition_hash.keys end |