Sha256: 06cb3db2ef5e06e233ebe10dd44e0e1a555229593b41e7a1be2b6243966365b9

Contents?: true

Size: 802 Bytes

Versions: 1

Compression:

Stored size: 802 Bytes

Contents

require 'spec_helper'

describe Jtv do
  let(:client) { Jtv::Client.new }

  describe '.client' do
    it 'initialize a Jtv::Client' do
      expect(Jtv.client).to be_a Jtv::Client
    end
  end

  context 'when including configuration' do
    it 'responds to configure' do
      Jtv.configure do |config|
        config.consumer_key = 'key'
      end
      expect(Jtv.consumer_key).to eq 'key'
    end
  end

  context 'when delegating to client' do
    before do
      allow(Jtv).to receive(:client).and_return client
    end

    it 'calls the correct method on client' do
      expect(client).to receive(:get).with '/test'
      Jtv.get '/test'
    end

    it "raises an error for methods client can't respond to" do
      expect { Jtv.fake_method }.to raise_error NoMethodError
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
jtv-2.0.0 spec/jtv_spec.rb