Sha256: ef62b77a8ed7801e98fbcfabe601071b2718ccd5a9873be213e20c7a621a1655

Contents?: true

Size: 1.17 KB

Versions: 1

Compression:

Stored size: 1.17 KB

Contents

require 'helper'

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

    it 'sends a get request' do
      stub = stub_request(:get, 'http://sandbox.feedly.com/v3/preferences')
      .to_return(body: '{ }')
      client.preferences
      expect(stub).to have_been_requested
    end

    it 'resoponds with hashie object' do
      subject = client.preferences
      expect(subject.size).to be >= 2
    end
  end

  describe '#update_preferences' do
    let(:preferences) do
      { :'category/reviews/entryOverviewSize' => 0,
        :'category/photography/entryOverviewSize' => 7 }
    end
    it 'sends a post request' do
      stub = stub_request(:post, 'http://sandbox.feedly.com/v3/preferences')
      .with(body: MultiJson.dump(preferences))
      client.update_preferences(preferences)
      expect(stub).to have_been_requested
    end

    it 'resoponds with hashie object' do
      subject = client.update_preferences(preferences)
      expect(subject.gender).to eq('female')
      expect(subject.fullName).to eq('Best lady')
    end
  end

end

Version data entries

1 entries across 1 versions & 1 rubygems

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