Module: VcrCable
- Extended by:
- VcrCable
- Included in:
- VcrCable
- Defined in:
- lib/vcr_cable.rb,
lib/vcr_cable/railtie.rb,
lib/vcr_cable/version.rb
Defined Under Namespace
Classes: InvalidMockingLibraryError, Railtie
Constant Summary
collapse
- CONFIG_FILE =
'vcr_cable.yml'
- DEFAULT_CONFIG =
{
'development' => {
'cassette_library_dir' => 'development_cassettes',
'allow_http_connections_when_no_cassette' => true
}
}
- VERSION =
'0.3.0'
Instance Method Summary
collapse
Instance Method Details
#config ⇒ Object
24
25
26
|
# File 'lib/vcr_cable.rb', line 24
def config
@config ||= default_config.merge local_config
end
|
16
17
18
19
20
21
22
|
# File 'lib/vcr_cable.rb', line 16
def configure_vcr
VCR.configure do |c|
c.hook_into config['hook_into']
c.cassette_library_dir = config['cassette_library_dir']
c.allow_http_connections_when_no_cassette = config['allow_http_connections_when_no_cassette']
end
end
|
#disabled_by_env? ⇒ Boolean
32
33
34
|
# File 'lib/vcr_cable.rb', line 32
def disabled_by_env?
%w(true 1).include?(ENV['DISABLE_VCR_CABLE'])
end
|
#enabled? ⇒ Boolean
28
29
30
|
# File 'lib/vcr_cable.rb', line 28
def enabled?
config.present? && !config['disable_vcr_cable']
end
|
#reset_config ⇒ Object
36
37
38
39
40
|
# File 'lib/vcr_cable.rb', line 36
def reset_config
%w[local_config config_file default_config config].each do |name|
instance_variable_set "@#{name}", nil
end
end
|