2014-12-06 19:10:24 -05:00
|
|
|
require "simplecov"
|
|
|
|
SimpleCov.start
|
2014-02-08 23:02:18 -05:00
|
|
|
|
2011-04-16 14:43:20 -04:00
|
|
|
|
2014-12-06 19:10:24 -05:00
|
|
|
require "httparty"
|
|
|
|
require "fakeweb"
|
2009-08-22 21:14:32 -04:00
|
|
|
|
2008-12-06 19:41:23 -05:00
|
|
|
def file_fixture(filename)
|
|
|
|
open(File.join(File.dirname(__FILE__), 'fixtures', "#{filename.to_s}")).read
|
|
|
|
end
|
|
|
|
|
2010-01-29 15:20:15 -05:00
|
|
|
Dir[File.expand_path(File.join(File.dirname(__FILE__),'support','**','*.rb'))].each {|f| require f}
|
2008-12-22 14:30:31 -05:00
|
|
|
|
2014-12-06 19:10:24 -05:00
|
|
|
RSpec.configure do |config|
|
2010-01-29 15:20:15 -05:00
|
|
|
config.include HTTParty::StubResponse
|
2010-07-08 22:21:38 -04:00
|
|
|
config.include HTTParty::SSLTestHelper
|
2012-04-15 22:51:39 -04:00
|
|
|
|
2010-05-13 21:48:42 -04:00
|
|
|
config.before(:suite) do
|
|
|
|
FakeWeb.allow_net_connect = false
|
|
|
|
end
|
2012-04-15 22:51:39 -04:00
|
|
|
|
2010-05-13 21:48:42 -04:00
|
|
|
config.after(:suite) do
|
|
|
|
FakeWeb.allow_net_connect = true
|
|
|
|
end
|
2012-09-07 12:36:01 -04:00
|
|
|
|
2014-12-06 19:10:24 -05:00
|
|
|
config.expect_with :rspec do |expectations|
|
|
|
|
expectations.include_chain_clauses_in_custom_matcher_descriptions = true
|
|
|
|
end
|
|
|
|
|
|
|
|
config.mock_with :rspec do |mocks|
|
2014-12-06 20:48:53 -05:00
|
|
|
mocks.verify_partial_doubles = false
|
2012-09-07 12:36:01 -04:00
|
|
|
end
|
2013-08-01 04:32:25 -04:00
|
|
|
|
2014-12-06 19:10:24 -05:00
|
|
|
config.filter_run :focus
|
|
|
|
config.run_all_when_everything_filtered = true
|
|
|
|
|
|
|
|
config.disable_monkey_patching!
|
|
|
|
|
|
|
|
config.warnings = true
|
|
|
|
|
|
|
|
if config.files_to_run.one?
|
|
|
|
config.default_formatter = 'doc'
|
2013-08-01 04:32:25 -04:00
|
|
|
end
|
2014-12-06 19:10:24 -05:00
|
|
|
|
|
|
|
config.profile_examples = 10
|
|
|
|
|
|
|
|
config.order = :random
|
|
|
|
|
|
|
|
Kernel.srand config.seed
|
2013-08-01 04:32:25 -04:00
|
|
|
end
|
2014-12-06 20:07:05 -05:00
|
|
|
|
|
|
|
RSpec::Matchers.define :use_ssl do
|
|
|
|
match do |connection|
|
|
|
|
connection.use_ssl?
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
RSpec::Matchers.define :use_cert_store do |cert_store|
|
|
|
|
match do |connection|
|
|
|
|
connection.cert_store == cert_store
|
|
|
|
end
|
|
|
|
end
|