[rspec-users] [cucumber] Is it possbile to access scenario name in steps?

wei wei weiwei9 at gmail.com
Tue Oct 14 12:40:31 EDT 2008


One of my examples now is like below
###  1001.feature
Feature: 1001
  1001 is the internal id for QAs to identify case

  Scenario: 1001
    Given the title is "function1_1001"
    .....
### function1.steps
Given /the title is "(.*)"/ do |title|
  @title = title
end

Actually the title is generated by the rule "function1_#{scenario_name}". So
ideally it could be written in this way

###  1001.feature
Feature: 1001
  1001 is the internal id for QAs to identify case

  Scenario: 1001
    Given the generated title
    .....
### function1.steps
Given /the generated title/ do
  @title = "function1_#{@scenario_name}" #though the variable @scenario_name
isn't available
end

So my question is: is it possible to get the name of the scenario/feature in
the step block?

ps: sorry, last message was sent by mistake.
-- 
Wei Wei
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://rubyforge.org/pipermail/rspec-users/attachments/20081015/3e870bc7/attachment-0001.html>


More information about the rspec-users mailing list