let
is not available in the scope of the shared example group definition, but only in the example (it, specify, scenario) scope.
To pass cassette_name
to the shared examples, you can use a method argument instead of let
. Here's how you can modify your shared examples and usage:
RSpec.shared_examples 'a vehicle' do |opts|
use_vcr_cassette(opts[:cassette_name])
end