Sha256: 15d89c29b4774d30b394f44889d6c7bab4a6047829733260e1e594373e0492fa
Contents?: true
Size: 1.18 KB
Versions: 1
Compression:
Stored size: 1.18 KB
Contents
require 'spec_helper' class SimpleLogger def info(msg) msg end end describe Typhoeus::Hydra do describe '#run_with_logging' do before :each do LazyResource.debug = true LazyResource.logger = SimpleLogger.new @hydra = Typhoeus::Hydra.new @hydra.stub!(:run_without_logging) @multi = @hydra.send(:instance_variable_get, :"@multi") end it 'logs if logging is enabled, there are items to process, and the queue has not yet started processing' do @multi.stub!(:easy_handles).and_return([1,2,3]) @multi.stub!(:running_count).and_return(0) LazyResource.logger.should_receive(:info).twice @hydra.run_with_logging end it 'does not log if there are no items to process' do @multi.stub!(:easy_handles).and_return([]) @multi.stub!(:running_count).and_return(0) LazyResource.logger.should_not_receive(:info) @hydra.run_with_logging end it 'does not log if the queue is already being processed' do @multi.stub!(:easy_handles).and_return([1,2,3]) @multi.stub!(:running_count).and_return(3) LazyResource.logger.should_not_receive(:info) @hydra.run_with_logging end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
lazy_resource-0.4.0 | spec/lazy_resource/ext/typhoeus_spec.rb |