Sha256: f5d5f886f4881c32b51b0148b35a612b30e41b91a215e3150a6a49304050a530
Contents?: true
Size: 1.65 KB
Versions: 2
Compression:
Stored size: 1.65 KB
Contents
require 'spec_helper' describe EM::Twitter::Client do describe '.connect' do before do conn = stub('EventMachine::Connection') conn.stub(:start_tls).and_return(nil) EM.stub(:connect).and_return(conn) end context 'without a proxy' do it 'connects to the configured host/port' do EventMachine.should_receive(:connect) .with(test_options[:host], test_options[:port], EventMachine::Twitter::Connection, kind_of(EM::Twitter::Client), test_options[:host], test_options[:port]) EM::Twitter::Client.connect(default_options) end end context 'when using a proxy' do it 'connects to the proxy server' do EventMachine.should_receive(:connect) .with("my-proxy", 8080, EventMachine::Twitter::Connection, kind_of(EM::Twitter::Client), 'my-proxy', 8080) EM::Twitter::Client.connect(default_options.merge(proxy_options)) end end it "should not trigger SSL until connection is established" do connection = stub('EventMachine::Connection') EM.should_receive(:connect).and_return(connection) EM.should_not_receive(:start_tls) client = EM::Twitter::Client.connect(:ssl => { :key => "/path/to/key.pem", :cert => "/path/to/cert.pem" }) end end describe '#respond_to?' do it 'delegate to the connection' do EM.run_block do client = EM::Twitter::Client.connect(default_options) client.respond_to?(:immediate_reconnect).should be_true end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
em-twitter-0.1.1 | spec/em-twitter/client_spec.rb |
em-twitter-0.1.0 | spec/em-twitter/client_spec.rb |