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

Matt Wynne matt at mattwynne.net
Wed Jun 15 08:29:12 EDT 2011


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

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?


matt at mattwynne.net
07974 430184

More information about the rspec-users mailing list