Sha256: d4cc79febc1821cd55755c682a262fc62dc224eee80c80bf8c31a9e61079b578
Contents?: true
Size: 1.55 KB
Versions: 3
Compression:
Stored size: 1.55 KB
Contents
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
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
contextio-2.0.0 | spec/unit/contextio/source_collection_spec.rb |
contextio-1.8.1 | spec/unit/contextio/source_collection_spec.rb |
contextio-1.8.0 | spec/unit/contextio/source_collection_spec.rb |