Sha256: cf5c23f2b1437eefd826cc88dbe2b7358bd4dc3d58fe74994d4596088a5357a9

Contents?: true

Size: 1.31 KB

Versions: 1

Compression:

Stored size: 1.31 KB

Contents

require 'spec_helper'

describe YoClient do
  it 'has a version number' do
    expect(YoClient::VERSION).not_to be nil
  end

  it 'can create instance' do
    expect(YoClient::Client.new('test')).to be_an_instance_of(YoClient::Client)
  end

  describe 'Instance of YoClient::Client' do
    before do
      @client = YoClient::Client.new('test')
    end

    describe '#yoall' do
      it 'hooks POST /yoall/' do
        expect_any_instance_of(Faraday::Connection).to(
          receive(:post)
          .with('/yoall/', { api_token: 'test' })
          .and_return(double('yo', body: {}))
        )
        @client.yoall
      end
    end

    describe '#yo' do
      it 'hooks POST /yo/' do
        expect_any_instance_of(Faraday::Connection).to(
          receive(:post)
          .with('/yo/', { api_token: 'test', username: 'YOUCUNE' })
          .and_return(double('yo', body: {}))
        )
        @client.yo('youcune')
      end
    end

    describe '#subscribers_count' do
      it 'hooks GET /subscribers_count/' do
        expect_any_instance_of(Faraday::Connection).to(
          receive(:get)
            .with('/subscribers_count/', { api_token: 'test' })
            .and_return(double('subscribers_count', body: { 'result' => 5 }))
        )
        expect(@client.subscribers_count).to eq 5
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
yo_client-0.0.2 spec/yo_client_spec.rb