Sha256: 6093f142fd80920e5811db5a723caca6275fcd4c31dd4830f78d904809842915
Contents?: true
Size: 1.36 KB
Versions: 2
Compression:
Stored size: 1.36 KB
Contents
# encoding: utf-8 load File.expand_path( '../../spec_helper.rb', File.dirname(__FILE__) ) describe Imap::Backup::Configuration::ConnectionTester do context '.test' do it 'should try to connect' do Imap::Backup::Account::Connection.should_receive(:new).with('foo') Imap::Backup::Configuration::ConnectionTester.test('foo') end it 'should return success if the connection works' do Imap::Backup::Account::Connection.stub!(:new). with('foo') result = Imap::Backup::Configuration::ConnectionTester.test('foo') result.should =~ /successful/ end it 'should handle no response' do e = Net::IMAP::NoResponseError.new(stub('o', :data => stub('foo', :text => 'bar'))) Imap::Backup::Account::Connection.stub!(:new). with('foo'). and_raise(e) result = Imap::Backup::Configuration::ConnectionTester.test('foo') result.should =~ /no response/i end it 'should handle other errors' do Imap::Backup::Account::Connection.stub!(:new). with('foo'). and_raise('error') result = Imap::Backup::Configuration::ConnectionTester.test('foo') result.should =~ /unexpected error/i end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
imap-backup-0.0.5 | spec/unit/configuration/connection_tester_spec.rb |
imap-backup-0.0.4 | spec/unit/configuration/connection_tester_spec.rb |