Skip to content

Instantly share code, notes, and snippets.

@kbaum
Created September 17, 2013 18:40
Show Gist options
  • Save kbaum/6598770 to your computer and use it in GitHub Desktop.
Save kbaum/6598770 to your computer and use it in GitHub Desktop.
require 'webrick/https'
require 'rack/handler/webrick'
def run_ssl_server(app, port)
opts = {
:Port => port,
:SSLEnable => true,
:SSLVerifyClient => OpenSSL::SSL::VERIFY_NONE,
:SSLPrivateKey => OpenSSL::PKey::RSA.new("./spec/support/server.key"),
:SSLCertificate => OpenSSL::X509::Certificate.new(File.read "./spec/support/server.crt"),
:SSLCertName => [["US", 'localhost']],
:AccessLog => [],
:Logger => WEBrick::Log::new(Rails.root.join("./log/capybara_test.log").to_s)
}
Rack::Handler::WEBrick.run(app, opts)
end
Capybara.server do |app, port|
run_ssl_server(app, port)
end
@volkanunsal
Copy link

There is an error on line #10. You need to include File.read to read the contents of the file just like in the line after that.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment