Question: best suitable example title for VCR file name usage
So I'm using VCR to capture and replay requests in specs. In Ruby I would usually do an around block and use this for a VCR cassette name:
RSpec.configure do |config|
config.around do |ex|
if ex.metadata.key?(:vcr)
VCR.use_cassette(example.metadata[:full_description].gsub(/\W/, "_")) do
ex.run
end
else
VCR.turned_off { ex.run }
end
end
end
But in Spectator example.metadata[:full_description]
doesn't contain a full description.
Instead I can only see example.name
which doesn't contain the parent names and example.example
which is probably the best guess so far.
Therefore I'm currently using
Spectator.configure do |config|
config.around_each do |example|
if example.metadata.has_key?(:vcr)
VCR.use_cassette(example.example.to_s.gsub(/\W+/, "_")) do
example.call
end
else
example.call
end
end
end
in my configuration but I'm not quite sure whether you would recommend this or rather something else.