Sha256: 73d48a32583ae71ab9a67e0b2e908c6af98d9b3287500545b597fd26c8a2e20e
Contents?: true
Size: 955 Bytes
Versions: 1
Compression:
Stored size: 955 Bytes
Contents
require 'spec_helper' describe Faraday::Conductivity::Repeater do let(:connection) { Faraday.new(url: $service_double_url) { |faraday| faraday.use :repeater, mode: :rapid, retries: 6 faraday.adapter Faraday.default_adapter } } it "retries after timeouts" do get_with_max(4).body.should eq "fast" end it "gives up after a number of retries" do expect { get_with_max(9) }.to raise_error(Faraday::Error::TimeoutError) end it "waits according to a pattern" do pattern = double :pattern Faraday::Conductivity::Repeater::Pattern.should_receive(:new).and_return(pattern) pattern.should_receive(:wait).with(1).ordered pattern.should_receive(:wait).with(2).ordered pattern.should_receive(:wait).with(3).ordered get_with_max(3) end def get_with_max(num) connection.get("/unreliable/#{num}") { |req| req.options[:timeout] = 1 req.options[:open_timeout] = 1 } end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
faraday-conductivity-0.1.0 | spec/middleware/repeater_spec.rb |