Sha256: c2b0e44a0e3b0b5c2def23e919e525bb21cc2de8eeea3ad39cf6da8af486f3bd

Contents?: true

Size: 468 Bytes

Versions: 6

Compression:

Stored size: 468 Bytes

Contents

require 'uri'

module Routemaster
  module Client
    module AssertionHelpers
      def assert_valid_url_throwing_error!(url, error_class)
        begin
          uri = URI.parse(url)
          unless uri.is_a? URI::HTTPS
            raise error_class, "url '#{url}' is invalid, must be an https url"
          end
        rescue URI::InvalidURIError
          raise error_class, "url '#{url}' is invalid, must be an https url"
        end
      end
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
routemaster-client-3.2.3 routemaster/client/assertion_helpers.rb
routemaster-client-3.2.0 routemaster/client/assertion_helpers.rb
routemaster-client-3.1.2 routemaster/client/assertion_helpers.rb
routemaster-client-3.1.1 routemaster/client/assertion_helpers.rb
routemaster-client-3.1.0 routemaster/client/assertion_helpers.rb
routemaster-client-3.0.0 routemaster/client/assertion_helpers.rb