Class: Cucumber2RSpec::Scenario
- Inherits:
-
Object
- Object
- Cucumber2RSpec::Scenario
- Defined in:
- lib/cucumber2rspec/scenario.rb
Overview
…
Instance Attribute Summary collapse
-
#_scenario ⇒ Object
readonly
Returns the value of attribute _scenario.
-
#feature ⇒ Object
readonly
Returns the value of attribute feature.
Instance Method Summary collapse
- #code ⇒ Object
- #code_without_block ⇒ Object
-
#initialize(feature, cucumber_ast_scenario) ⇒ Scenario
constructor
A new instance of Scenario.
- #name ⇒ Object
- #steps ⇒ Object
Constructor Details
#initialize(feature, cucumber_ast_scenario) ⇒ Scenario
Returns a new instance of Scenario.
7 8 9 10 |
# File 'lib/cucumber2rspec/scenario.rb', line 7 def initialize feature, cucumber_ast_scenario @feature = feature @_scenario = cucumber_ast_scenario # Cucumber::Ast::Scenario end |
Instance Attribute Details
#_scenario ⇒ Object (readonly)
Returns the value of attribute _scenario.
5 6 7 |
# File 'lib/cucumber2rspec/scenario.rb', line 5 def _scenario @_scenario end |
#feature ⇒ Object (readonly)
Returns the value of attribute feature.
5 6 7 |
# File 'lib/cucumber2rspec/scenario.rb', line 5 def feature @feature end |
Instance Method Details
#code ⇒ Object
31 32 33 34 35 36 |
# File 'lib/cucumber2rspec/scenario.rb', line 31 def code Cucumber2RSpec.log { ' ' + name } the_code = ' it ' + name.inspect + " do\n" the_code << code_without_block the_code << ' end' end |
#code_without_block ⇒ Object
20 21 22 23 24 25 26 27 28 29 |
# File 'lib/cucumber2rspec/scenario.rb', line 20 def code_without_block code = Step.code_for_steps(steps) if background = feature.background # remove the background code from the scenario code = code.sub background.code_without_block.sub(/\n$/, ''), '' else code end end |
#name ⇒ Object
12 13 14 |
# File 'lib/cucumber2rspec/scenario.rb', line 12 def name _scenario.name end |