Forum: RSpec [Cucumber] how to get name from scenario hook?

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.
Jim M. (Guest)
on 2009-05-02 00:31
(Received via mailing list)
Hi,

Given the hook:

After do |scenario|

end

How do I get the name of the scenario from the scenario parameter?

scenario.name doesn't  work, and I looked through the source code and
it was not immediately obvious to me.

Thanks
Aslak H. (Guest)
on 2009-05-02 01:55
(Received via mailing list)
> scenario.name doesn't  work, and I looked through the source code and
> it was not immediately obvious to me.
>

You can call to_sexp on it and get it from there. Or you can file a
Lighthouse ticket if you want the #name accessor.
wolfmanjm (Guest)
on 2009-05-02 03:27
(Received via mailing list)
to_sexp should do it for now, but I'll file a ticket as #name would be
useful.

Thanks
wolfmanjm (Guest)
on 2009-05-02 08:27
(Received via mailing list)
filed the ticket, as it turns out that the name is not available in
the sexp for scenario outlines.

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