Class: Thor::Task

Inherits:
Object
  • Object
show all
Defined in:
lib/vcr_helper.rb

Instance Method Summary collapse

Instance Method Details

#run_with_vcr(instance, args = []) ⇒ Object



16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
# File 'lib/vcr_helper.rb', line 16

def run_with_vcr(instance, args=[])
  if ENV['VCR_CASSETTE']
    cassette_name = ENV.delete('VCR_CASSETTE')

    VCR.configure do |c|
      c.cassette_library_dir = Holistics.root.join 'features/vcr_cassettes'
      c.default_cassette_options = {:record => :new_episodes}
      c.hook_into :webmock
    end

    VCR.use_cassette(cassette_name) do
      run_without_vcr(instance, args)
    end
  else
    run_without_vcr(instance, args)
  end


end