I have multiple specs, wish to create separate log files per spec with the spec file name. I need to know which spec file is currently loaded in spec_helper.rb
.
I have to create logger object in spec helper
RSpec.configure do |config|
config.before(:all) do |example_group|
loaded_files = config.instance_variable_get("@files_to_run")
# after getting the current spec file name
# will create log file here
end
end
loaded_files
have an array of all the spec files that I chose for execution. I need to know which is currently loaded?
I do not want to put a before(:each) block, it will increase the run time and i just need the filename, not a good solution to use before(:each) block.