1
0
Fork 0
mirror of https://github.com/jnunemaker/httparty synced 2023-03-27 23:23:07 -04:00
httparty/spec/spec_helper.rb
Narsimham Chelluri bc551bd1f2 Made SSL connections use the system certificate store by default.
- Set http.verify_mode to OpenSSL::SSL::VERIFY_PEER by default
- Use OpenSSL::X509::Store.new as certificate store unless another is specified

Adapted from Faraday.
See: b25adc0ca6/lib/faraday/adapter/net_http.rb (L100)
2013-08-01 01:32:25 -07:00

36 lines
803 B
Ruby

$:.push File.expand_path("../lib", __FILE__)
require "httparty"
require 'spec/autorun'
require 'fakeweb'
def file_fixture(filename)
open(File.join(File.dirname(__FILE__), 'fixtures', "#{filename.to_s}")).read
end
Dir[File.expand_path(File.join(File.dirname(__FILE__),'support','**','*.rb'))].each {|f| require f}
Spec::Runner.configure do |config|
config.include HTTParty::StubResponse
config.include HTTParty::SSLTestHelper
config.before(:suite) do
FakeWeb.allow_net_connect = false
end
config.after(:suite) do
FakeWeb.allow_net_connect = true
end
end
Spec::Matchers.define :use_ssl do
match do |connection|
connection.use_ssl?
end
end
Spec::Matchers.define :use_cert_store do |cert_store|
match do |connection|
connection.cert_store == cert_store
end
end