Module: RSpec::WebserviceMatchers

Defined in:
lib/rspec/webservice_matchers.rb,
lib/rspec/webservice_matchers/version.rb

Constant Summary collapse

VERSION =
"0.0.4"

Class Method Summary collapse

Class Method Details

.has_valid_ssl_cert?(domain_name) ⇒ Boolean



7
8
9
10
11
12
13
14
15
# File 'lib/rspec/webservice_matchers.rb', line 7

def self.has_valid_ssl_cert?(domain_name)
  begin
    Curl.get "https://#{domain_name}"  # Faster than Curl.head; not sure why.
    return true
  rescue Curl::Err::ConnectionFailedError, Curl::Err::SSLCACertificateError, Curl::Err::SSLPeerCertificateError
    # Not serving SSL, expired, or incorrect domain name
    return false
  end
end