Sha256: 98b6c77c6b9be18188d2ffcc4d0b2d6a487837c85a1c5d98c60606b1df8b8b42

Contents?: true

Size: 1016 Bytes

Versions: 1

Compression:

Stored size: 1016 Bytes

Contents

require 'helper'

describe Feedlr::Gateway::Feeds, vcr: { record: :new_episodes } do
  let(:client) { Feedlr::Client.new(sandbox: true) }

  describe '#feed'  do
    let(:feed_id) { 'feed/http://feeds.engadget.com/weblogsinc/engadget' }

    it 'calls feeds' do
      allow(client).to receive(:feeds).and_return([1])
      expect(client).to receive(:feeds).with([feed_id])
      client.feed(feed_id)
    end
  end

  describe '#feeds' do
    let(:feeds_ids) do
      ['feed/http://feeds.engadget.com/weblogsinc/engadget',
       'feed/http://www.yatzer.com/feed/index.php']
    end

    it 'sends a post request' do
      stub = stub_request(:post, 'http://sandbox.feedly.com/v3/feeds/.mget')
      .with(body: MultiJson.dump(feeds_ids))
      client.feeds(feeds_ids)
      expect(stub).to have_been_requested
    end

    it 'resoponds with hashie object' do
      subject = client.feeds(feeds_ids)
      expect(subject.size).to eq(2)
      expect(subject.first.website).to be_instance_of String
    end
  end

end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
feedlr-0.1.0 spec/feedly/gateway/feeds_spec.rb