Sha256: fa43a8c05626b00b9fd92c77b6888086356c87ac800ce010f751f81fd5559f2b
Contents?: true
Size: 1.95 KB
Versions: 2
Compression:
Stored size: 1.95 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 it 'sends Yo with a link' do expect_any_instance_of(Faraday::Connection).to( receive(:post) .with('/yoall/', { api_token: 'test', link: 'http://youcune.com/' }) .and_return(double('yo', body: {}, success?: true)) ) @client.yoall(link: 'http://youcune.com/') 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 it 'sends Yo with a link' do expect_any_instance_of(Faraday::Connection).to( receive(:post) .with('/yo/', { api_token: 'test', username: 'YOUCUNE', link: 'http://youcune.com/' }) .and_return(double('yo', body: {}, success?: true)) ) @client.yo('youcune', link: 'http://youcune.com/') 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
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
yo_client-0.1.1 | spec/yo_client_spec.rb |
yo_client-0.1.0 | spec/yo_client_spec.rb |