Sha256: 9bb189ffcc0095d0fb3010d432a2acfa4e97b766be420b5f3e4d89f572c874f5

Contents?: true

Size: 1.67 KB

Versions: 1

Compression:

Stored size: 1.67 KB

Contents

require 'helper'

describe Feedlr::Gateway::Opml, vcr: { record: :new_episodes } do
  let(:client) do
    Feedlr::Client.new(sandbox: true, oauth_access_token: access_token)
  end
  describe '#user_opml'  do

    it 'sends a get request' do
      stub = stub_request(:get, 'http://sandbox.feedly.com/v3/opml')
      .with(headers: { 'Content-Type' => 'text/xml' })
      client.user_opml
      expect(stub).to have_been_requested
    end

    it 'resoponds with hashie object' do
      subject = client.user_opml
      expect(subject.opml.size).to be(3)
    end
  end

  describe '#import_opml'  do
    before :each do
      data = '
<?xml version="1.0" encoding="UTF-8"?>
<opml version="1.0">
 <body>
  <outline title="MY" icon="">
   <outline title="Coding Horror" type="rss" xmlUrl="http://feeds.feedburner.'\
   'com/codinghorror" htmlUrl="http://www.codinghorror.com/blog/"/>
   <outline title="Git Ready" type="rss" xmlUrl="http://feeds.feedburner.com/'\
   'git-ready" htmlUrl="http://gitready.com/"/>
   <outline title="PragDave" type="rss" xmlUrl="http://pragdave.blogs'\
   '.pragprog.com/pragdave/atom.xml" htmlUrl="http://pragdave.blogs'\
   '.pragprog.com/pragdave/"/>
  </outline>
 </body>
</opml>
'
      @xml_data = StringIO.new(data)
    end
    it 'sends a post request' do
      stub = stub_request(:post, 'http://sandbox.feedly.com/v3/opml')
      .with(headers:  { 'Content-Type' => 'text/xml' },
            body: @xml_data.read)
      @xml_data.rewind
      client.import_opml(@xml_data)
      expect(stub).to have_been_requested
    end

    it 'resoponds with hashie object' do
      subject = client.import_opml(@xml_data)
      expect(subject).to be_a(Feedlr::Success)
    end
  end

end

Version data entries

1 entries across 1 versions & 1 rubygems

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