Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also compare across forks.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also compare across forks.
base fork: highgroove/grocer
base: 611ca72f7e
...
head fork: highgroove/grocer
compare: 62568209a4
  • 2 commits
  • 4 files changed
  • 0 commit comments
  • 1 contributor
View
2  lib/grocer.rb
@@ -1,4 +1,4 @@
require_relative "grocer/version"
require_relative "grocer/notification"
require_relative "grocer/connection"
-require_relative "grocer/failed_deliver_attempt"
+require_relative "grocer/failed_delivery_attempt"
View
16 lib/grocer/connection.rb
@@ -1,4 +1,5 @@
require 'forwardable'
+require 'grocer/no_certificate_error'
require 'grocer/ssl_connection'
module Grocer
@@ -27,11 +28,16 @@ def write(content)
private
def ssl
- @ssl_connection ||=
- Grocer::SSLConnection.new(certificate: certificate,
- passphrase: passphrase,
- gateway: gateway,
- port: port)
+ @ssl_connection ||= build_connection
+ end
+
+ def build_connection
+ fail Grocer::NoCertificateErrror unless certificate
+
+ Grocer::SSLConnection.new(certificate: certificate,
+ passphrase: passphrase,
+ gateway: gateway,
+ port: port)
end
def with_open_connection(&block)
View
4 lib/grocer/no_certificate_error.rb
@@ -0,0 +1,4 @@
+module Grocer
+ class NoCertificateErrror < StandardError
+ end
+end
View
5 spec/grocer/connection_spec.rb
@@ -40,6 +40,11 @@
subject.port.should == connection_options[:port]
end
+ it 'requires a certificate' do
+ connection_options[:certificate] = nil
+ -> { subject.read }.should raise_error(Grocer::NoCertificateErrror)
+ end
+
context 'an open SSLConnection' do
before do
ssl.stubs(:connected?).returns(true)

No commit comments for this range

Something went wrong with that request. Please try again.