Sha256: 51247ed29cca4ba23fa32bb1d8852d0f09a2b046ee88d21d531d9e1736da9a9f
Contents?: true
Size: 1.53 KB
Versions: 4
Compression:
Stored size: 1.53 KB
Contents
# coding: utf-8 require 'simplecov' require 'coveralls' require 'trell' require 'rspec' require 'ap' require 'vcr' require 'webmock/rspec' SimpleCov.formatter = SimpleCov::Formatter::MultiFormatter[ SimpleCov::Formatter::HTMLFormatter, Coveralls::SimpleCov::Formatter ] SimpleCov.start WebMock.disable_net_connect!(allow: 'coveralls.io') RSpec.configure { |c| c.include WebMock::API } VCR.configure do |c| c.configure_rspec_metadata! c.cassette_library_dir = 'spec/cassettes' c.hook_into :webmock c.default_cassette_options = { serialize_with: :json, preserve_exact_body_bytes: true, decode_compressed_response: true, record: :once } end class String def strip_heredoc indent = scan(/^[ \t]*(?=\S)/).min.size || 0 gsub(/^[ \t]{#{indent}}/, '') end def no_lf gsub(/\n|\r\n/, ' ') end def pretty_heredoc strip_heredoc.no_lf.strip end def escaping gsub(/https?:\/\//, '').gsub(/\/|\./, '_') end end def fixture_path File.expand_path('../fixtures', __FILE__) end def fixture(file) File.read(fixture_path + '/' + file) end def decode(file) JSON.parse(fixture file) end def json_response(file) { body: fixture(file), headers: { content_type: 'application/json; charset=utf-8' } } end def method_missing(method, *args, &block) if method =~ /^a_(get|post|put|delete)$/ a_request(Regexp.last_match[1].to_sym, *args, &block) elsif method =~ /^stub_(get|post|put|delete|head|patch)$/ stub_request(Regexp.last_match[1].to_sym, *args, &block) else super end end
Version data entries
4 entries across 4 versions & 1 rubygems
Version | Path |
---|---|
trell-0.0.4 | spec/helper.rb |
trell-0.0.3 | spec/helper.rb |
trell-0.0.2 | spec/helper.rb |
trell-0.0.1 | spec/helper.rb |