Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Add test for exception behavior
  • Loading branch information
kyledrake authored and stevenharman committed Nov 16, 2012
1 parent 44fbefb commit f7de1d1
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion spec/grocer/connection_spec.rb
Expand Up @@ -55,6 +55,11 @@
subject.connect
ssl.should have_received(:connect)
end

it 'raises CertificateExpiredError for OpenSSL::SSL::SSLError with /certificate expired/i message' do
ssl.stubs(:write).raises(OpenSSL::SSL::SSLError.new('certificate expired'))
-> {subject.write('abc123')}.should raise_error(Grocer::CertificateExpiredError)
end

context 'an open SSLConnection' do
before do
Expand Down Expand Up @@ -91,7 +96,7 @@
end

describe 'retries' do
[SocketError, OpenSSL::SSL::SSLError, Errno::EPIPE].each do |error|
[SocketError, Errno::EPIPE].each do |error|
it "retries #read in the case of an #{error}" do
ssl.stubs(:read).raises(error).then.returns(42)
subject.read
Expand Down

0 comments on commit f7de1d1

Please sign in to comment.