Sha256: 6d896af7bd55c6dce38836c3fa03d5fc53187d3e65b0601f9192f5708a6a3fef

Contents?: true

Size: 1.78 KB

Versions: 1

Compression:

Stored size: 1.78 KB

Contents

require 'helper'

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

  describe '#user_categories' do
    it 'sends a get request' do
      stub = stub_request(:get, 'http://sandbox.feedly.com/v3/categories')
      client.user_categories
      expect(stub).to have_been_requested
    end

    it 'resoponds with hashie object' do
      subject = client.user_categories
      expect(subject.size).to be >= 2
      expect(subject.first.label).to eq('Design')
    end
  end

  describe '#change_category_label' do
    let(:category_id) do
      'user/96cc52b7-a17f-4ce0-9b38-de1b6f08f156/category/Kool'
    end
    let(:new_label) { 'testing' }
    it 'sends a post request' do
      stub = stub_request(:post, 'http://sandbox.feedly.com/v3/categories/'\
                          "#{CGI.escape(category_id)}")
      .with(body: MultiJson.dump(label: new_label))
      client.change_category_label(category_id, new_label)
      expect(stub).to have_been_requested
    end

    it 'resoponds with hashie object' do
      subject = client.change_category_label(category_id, new_label)
      expect(subject).to be_a(Feedlr::Success)
    end
  end

  describe '#delete_category'  do
    let(:category_id) do
      'user/96cc52b7-a17f-4ce0-9b38-de1b6f08f156/category/Tech'
    end
    it 'sends a delete request' do
      stub = stub_request(:delete, 'http://sandbox.feedly.com/v3/categories/'\
        "#{CGI.escape(category_id)}")
      client.delete_category(category_id)
      expect(stub).to have_been_requested
    end

    it 'resoponds with hashie object' do
      subject = client.delete_category(category_id)
      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/categories_spec.rb