Class: Cucumber::Glue::Snippet::CucumberExpression
Class Method Summary
collapse
Instance Method Summary
collapse
Methods inherited from BaseSnippet
cli_option_string, #initialize, #step
Class Method Details
.description ⇒ Object
111
112
113
|
# File 'lib/cucumber/glue/snippet.rb', line 111
def self.description
'Cucumber Expressions'
end
|
Instance Method Details
#parameters(expr) ⇒ Object
105
106
107
108
109
|
# File 'lib/cucumber/glue/snippet.rb', line 105
def parameters(expr)
parameter_names = expr.parameter_names
multiline_argument.append_block_parameter_to(parameter_names)
parameter_names.empty? ? '' : " |#{parameter_names.join(", ")}|"
end
|
#to_s ⇒ Object
91
92
93
94
95
96
97
98
99
100
101
102
103
|
# File 'lib/cucumber/glue/snippet.rb', line 91
def to_s
= generated_expressions.each_with_index.map do |expr, i|
prefix = i == 0 ? '' : '# '
"#{prefix}#{code_keyword}(\"#{expr.source}\") do#{parameters(expr)}"
end.join("\n")
body = String.new
multiline_argument.(body)
body << " pending # Write code here that turns the phrase above into concrete actions\n"
body << 'end'
"#{}\n#{body}"
end
|
#typed_pattern ⇒ Object
87
88
89
|
# File 'lib/cucumber/glue/snippet.rb', line 87
def typed_pattern
"(\"#{generated_expressions[0].source}\")"
end
|