Sha256: 171787f0e3ed00904fd0f69099f9367a9072a48dec4b952e6f5d16ed921abc96
Contents?: true
Size: 1017 Bytes
Versions: 3
Compression:
Stored size: 1017 Bytes
Contents
require 'contextio/oauth_provider_collection' describe ContextIO::OAuthProviderCollection do let(:api) { double('API', url_for: 'url from api') } subject { ContextIO::OAuthProviderCollection.new(api) } describe "#create" do before do allow(api).to receive(:request).with(:post, anything, anything).and_return({ provider_consumer_key: 'test_key' }) end it "posts to the api" do expect(api).to receive(:request).with( :post, 'url from api', type: 'GMAIL', provider_consumer_key: 'test_key', provider_consumer_secret: 'test_secret' ) subject.create('GMAIL', 'test_key', 'test_secret') end it "doesn't make any more API requests than it needs to" do expect(api).to receive(:request).exactly(:once) subject.create('GMAIL', 'test_key', 'test_secret') end it "returns an OAuthProvider" do expect(subject.create('GMAIL', 'test_key', 'test_secret')).to be_a(ContextIO::OAuthProvider) end end end
Version data entries
3 entries across 3 versions & 1 rubygems