Sha256: 04db63a42c4ac09f08803c61200f393ce573195dff3cf7c034be7da6f15cbd24

Contents?: true

Size: 1.13 KB

Versions: 10

Compression:

Stored size: 1.13 KB

Contents

require_relative 'spec_helper'

describe RRImm::Fetcher do
  let(:basic_conf) do
    xkcd_file = File.join(File.dirname(__FILE__), 'xkcd.xml')
    xkcd_uri = 'http://toto.com/xkcd.xml'

    stub_request(:get, xkcd_uri).
      to_return(status: 200, body: File.read(xkcd_file))
    feed = RRImm::FeedConfig.new xkcd_uri do
      pipe 'cat > /dev/null'
    end
    cache = double('cache_mock')
    allow(RRImm::Cache).to receive(:new).and_return(cache)
    allow(cache).to receive(:path)

    allow(cache).to receive(:read).and_return(3829)
    allow(cache).to receive(:save)

    config = RRImm::Config.new
    config.feeds['local_xkcd'] = feed
    config
  end

  describe '#initialize' do
    it 'createscorrectly' do
      expect { RRImm::Fetcher.new(basic_conf, {}) }.not_to raise_error
    end
  end

  describe '#fetch' do
    it 'fetches correctly' do
      fetcher = RRImm::Fetcher.new basic_conf, {}
      expect { fetcher.fetch }.not_to raise_error
    end
    it 'fetches correctly when using concurrency' do
      fetcher = RRImm::Fetcher.new basic_conf, {'concurrency' => 5}
      expect { fetcher.fetch }.not_to raise_error
    end
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
rrimm-0.14.10 spec/fetcher_spec.rb
rrimm-0.14.9 spec/fetcher_spec.rb
rrimm-0.14.8 spec/fetcher_spec.rb
rrimm-0.14.7 spec/fetcher_spec.rb
rrimm-0.14.6 spec/fetcher_spec.rb
rrimm-0.14.5 spec/fetcher_spec.rb
rrimm-0.14.4 spec/fetcher_spec.rb
rrimm-0.14.3 spec/fetcher_spec.rb
rrimm-0.14.1 spec/fetcher_spec.rb
rrimm-0.14.0 spec/fetcher_spec.rb