Module: Typhoeus::SpecCacheMacros::ClassMethods

Defined in:
lib/typhoeus/spec_cache_macros.rb

Instance Method Summary collapse

Instance Method Details

#typhoeus_spec_cache(cache_path, &block) ⇒ Object



11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
# File 'lib/typhoeus/spec_cache_macros.rb', line 11

def typhoeus_spec_cache(cache_path, &block)
  describe "HTTP cache suite for #{cache_path}" do
    hydra = Typhoeus::Hydra.new
    cache = SpecCache.new(hydra, cache_path)

    before(:each) do
      stub_hydra(hydra)
    end

    instance_exec(hydra, &block)

    after(:all) do
      cache.remove_unnecessary_cache_files!
      cache.dump_cache_fixtures!
      cache.clear_hydra_callbacks!
    end
  end
end