Sha256: 7706e86890b68e169ef7af3a490f768c15bf25df85d6c5d94f9db7557b1f36f3

Contents?: true

Size: 1.28 KB

Versions: 1

Compression:

Stored size: 1.28 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: {}, success?: true))
        )
        @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: {}, success?: true))
        )
        @client.yo('youcune')
      end
    end

    describe '#subscribers_count' do
      it 'hooks GET /subscribers_count/' do
        expect_any_instance_of(Faraday::Connection).to(
          receive(:get)
            .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.3 spec/yo_client_spec.rb