Repository URL to install this package:
|
Version:
4.0 ▾
|
require 'simplecov'
require 'coveralls'
SimpleCov.formatters = [SimpleCov::Formatter::HTMLFormatter, Coveralls::SimpleCov::Formatter]
SimpleCov.start do
add_filter '/spec/'
minimum_coverage(90)
end
require 'get_fitter'
require 'rspec'
require 'webmock/rspec'
WebMock.disable_net_connect!(allow: %w(codeclimate.com coveralls.io))
RSpec.configure do |config|
config.expect_with :rspec do |expectations|
# will become the default in RSpec 4
expectations.include_chain_clauses_in_custom_matcher_descriptions = true
end
config.mock_with :rspec do |mocks|
# will become the default in RSpec 4
mocks.verify_partial_doubles = true
end
config.filter_run :focus
config.run_all_when_everything_filtered = true
config.warnings = true
config.order = :random
end
def stub_delete(url)
stub_request(:delete, getfitter_url(url))
end
def stub_get(url)
stub_request(:get, getfitter_url(url))
end
def stub_head(url)
stub_request(:head, getfitter_url(url))
end
def stub_patch(url)
stub_request(:patch, getfitter_url(url))
end
def stub_post(url)
stub_request(:post, getfitter_url(url))
end
def stub_put(url)
stub_request(:put, getfitter_url(url))
end
def fixture_path
File.expand_path('../fixtures', __FILE__)
end
def fixture(file)
File.new(fixture_path + '/' + file)
end
def json_response(file)
{
body: fixture(file),
headers: {
content_type: 'application/json; charset=utf-8'
}
}
end
def getfitter_url(url)
return url if url =~ /^http/
url = File.join(GetFitter::API.configuration.url, url)
uri = Addressable::URI.parse(url)
uri.path.gsub!('3000//', '/')
uri.path.gsub!('com//', '/')
uri.to_s
end