Sha256: 948639b09e57890fddb8c125e59ce38ef1618948512490bb9379f77915490b0d
Contents?: true
Size: 1.57 KB
Versions: 4
Compression:
Stored size: 1.57 KB
Contents
require 'spec_helper' require 'contextio/source_collection' describe ContextIO::SourceCollection do let(:api) { double('api', url_for: 'url from api') } subject { ContextIO::SourceCollection.new(api) } describe "#create" do before do allow(api).to receive(:request).with(:post, anything, anything).and_return( 'success' => true, 'resource_url' => 'resource_url' ) end it "posts to the api" do expect(api).to receive(:request).with( :post, 'url from api', anything ) subject.create('hello@gmail.com', 'imap.email.com', 'hello', true, 993, 'IMAP') end it "converts boolean to number string for ssl" do expect(api).to receive(:request).with( anything, anything, hash_including(:use_ssl => '1') ) subject.create('hello@gmail.com', 'imap.email.com', 'hello', true, 993, 'IMAP') end it "converts integer to number string for port" do expect(api).to receive(:request).with( anything, anything, hash_including(:port => '993') ) subject.create('hello@gmail.com', 'imap.email.com', 'hello', true, 993, 'IMAP') end it "doesn't make any more API calls than it needs to" do expect(api).to_not receive(:request).with(:get, anything, anything) subject.create('hello@gmail.com', 'imap.email.com', 'hello', true, 993, 'IMAP') end it "returns a Source" do expect(subject.create('hello@gmail.com', 'imap.email.com', 'hello', true, 993, 'IMAP')).to be_a(ContextIO::Source) end end end
Version data entries
4 entries across 4 versions & 1 rubygems