Hi Joao,

Did you find an answer?

On 2021-6-11 11:30 pm, Joao Miguel Ferreira wrote:
Hello all,

Is there a way to ask rspec to print the path of the file from which tests are being run?

Today, while reading the 'Effective Testing with RSpec 3' book, I found that you can access metadata in the context level:

RSpec.describe 'My Exciting Class' do
  puts metadata

  context 'when condition' do
    it 'succeeds' do
    end
  end
end

The metadata outputs a bunch of stuff, including :file_path and :absolute_file_path

Hope this helps.

Best Regards,
Mohit.
2021-6-21 | 8:07 pm.

--
You received this message because you are subscribed to the Google Groups 
"rspec" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/rspec/14c4135a-fa88-a133-dc55-345738666467%40onghu.com.

Reply via email to