Class: Botrytis::CucumberIntegration::StepDefinitionAdapter

Inherits:
Object
  • Object
show all
Defined in:
lib/botrytis/cucumber.rb

Overview

Adapter to make modern Cucumber StepDefinition compatible with semantic matcher

Instance Method Summary collapse

Constructor Details

#initialize(step_def) ⇒ StepDefinitionAdapter

Returns a new instance of StepDefinitionAdapter.



68
69
70
# File 'lib/botrytis/cucumber.rb', line 68

def initialize(step_def)
  @step_def = step_def
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(method, *args, &block) ⇒ Object



81
82
83
# File 'lib/botrytis/cucumber.rb', line 81

def method_missing(method, *args, &block)
  @step_def.send(method, *args, &block)
end

Instance Method Details

#procObject



76
77
78
79
# File 'lib/botrytis/cucumber.rb', line 76

def proc
  # Create a proc that delegates to the step definition
  lambda { |*args| @step_def.invoke(nil, *args) }
end

#regexp_sourceObject



72
73
74
# File 'lib/botrytis/cucumber.rb', line 72

def regexp_source
  @step_def.expression.to_s
end

#respond_to_missing?(method, include_private = false) ⇒ Boolean

Returns:

  • (Boolean)


85
86
87
# File 'lib/botrytis/cucumber.rb', line 85

def respond_to_missing?(method, include_private = false)
  @step_def.respond_to?(method, include_private)
end