Forum: RSpec [cucumber] Is it possbile to access scenario name in steps?

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
59e1463074e0619bc06b8654bf5ac98d?d=identicon&s=25 wei wei (Guest)
on 2008-10-14 18:39
(Received via mailing list)
One of my examples now is like below
###  case_1001.feature
Feature: case_1001


  Scenario: 10001
    Given the network is CBS
    Given the data :
    Then there should be an asset with internal id and title1 in DB
59e1463074e0619bc06b8654bf5ac98d?d=identicon&s=25 wei wei (Guest)
on 2008-10-14 18:41
(Received via mailing list)
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.
0be0e4aa42aacd9a8a95c792de273ca7?d=identicon&s=25 aslak hellesoy (Guest)
on 2008-10-14 21:24
(Received via mailing list)
On Tue, Oct 14, 2008 at 6:40 PM, wei wei <weiwei9@gmail.com> wrote:
> end
>   @title = "function1_#{@scenario_name}" #though the variable @scenario_name
> isn't available
> end

Please try to exclude irrelevant information when asking a question.
Everything you said above doesn't make your question any clearer.

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

It's not, but you can register a feature request.

Take a look at
http://rspec.lighthouseapp.com/projects/16211-cucu...

It sounds like what you're asking for is related.

Aslak
This topic is locked and can not be replied to.