我想让capybara在ssl上运行测试puma服务器。需要帮助配置它,请:
Capybara.register_server :ssl_puma do |app, port, host|
require 'rack/handler/puma'
Rack::Handler::Puma.run(app, Host: host, Port: port, Threads: "0:1") do |server|
ctx = Puma::MiniSSL::Context.new
ctx.key = ENV['SSL_KEY_PATH']
ctx.cert = ENV['SSL_CERT_PATH']
ctx.verify_mode = Puma::MiniSSL::VERIFY_NONE
server.add_ssl_listener host, port, ctx # this line is wrong, but that's the gyst of what needs to happen
end
end
有什么想法吗?
答案 0 :(得分:0)
如果您使用最新版本的Capybara,我相信您应该可以做类似的事情
Capybara.server = :puma, { Host: "ssl://#{Capybara.server_host}?key=#{ENV['SSL_KEY_PATH']}&cert=#{ENV['SSL_CERT_PATH']" }