[rspec-users] Name of current example's file:line in a before block?

David Chelimsky dchelimsky at gmail.com
Wed Jun 15 08:47:02 EDT 2011

On Jun 15, 2011, at 7:29 AM, Matt Wynne wrote:

> Hi,
> I have an idea for a tool I want to build. In a Cucumber Before() block, I can say:
> Before do |scenario|
>  puts scenario.file_colon_line
> end
> That then gives me the information I'd need to run that test case (and only that test case) again.
> Is there any way (however hacky / brittle) to do something similar in an RSpec before block, or do I need to delve into writing a formatter?
> cheers,
> Matt

before { puts example.location }


More information about the rspec-users mailing list