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.