Class: Cucumber::JBehave::JBehaveStepDefinition
- Defined in:
- lib/cucumber/jbehave.rb
Overview
Adapter for JBehave org.jbehave.scenario.steps.CandidateStep
Instance Method Summary collapse
- #file_colon_line ⇒ Object
- #format_args(step_name, format) ⇒ Object
-
#initialize(jbehave_steps, jbehave_candidate_step) ⇒ JBehaveStepDefinition
constructor
A new instance of JBehaveStepDefinition.
- #invoke(world, args, step_name) ⇒ Object
- #step_match(name_to_match, name_to_report) ⇒ Object
Constructor Details
#initialize(jbehave_steps, jbehave_candidate_step) ⇒ JBehaveStepDefinition
Returns a new instance of JBehaveStepDefinition.
23 24 25 26 27 |
# File 'lib/cucumber/jbehave.rb', line 23 def initialize(jbehave_steps, jbehave_candidate_step) @jbehave_steps = jbehave_steps @jbehave_candidate_step = jbehave_candidate_step @regexp = Regexp.new(jbehave_candidate_step.pattern.pattern) end |
Instance Method Details
#file_colon_line ⇒ Object
37 38 39 |
# File 'lib/cucumber/jbehave.rb', line 37 def file_colon_line @jbehave_steps.java_class.name end |
#format_args(step_name, format) ⇒ Object
41 42 43 |
# File 'lib/cucumber/jbehave.rb', line 41 def format_args(step_name, format) step_name.gzub(@regexp, format) end |
#invoke(world, args, step_name) ⇒ Object
45 46 47 48 49 50 51 |
# File 'lib/cucumber/jbehave.rb', line 45 def invoke(world, args, step_name) step = @jbehave_candidate_step.createFrom("Given #{step_name}") # JBehave doesn't care about the adverb. step = @jbehave_candidate_step.__send__(:createStep, "Given #{step_name}", args) # JBehave doesn't care about the adverb. result = step.perform result.describeTo(Reporter) end |