Sha256: 13b1a239134f8b671c3315a08c9ba0109e49c261be2239a19988b6c466a95f7e

Contents?: true

Size: 1.36 KB

Versions: 13

Compression:

Stored size: 1.36 KB

Contents

$LOAD_PATH.unshift(File.expand_path('../../lib', __FILE__))
$LOAD_PATH.uniq!

require 'rspec'
require 'faraday'

begin
  require 'simplecov'
  require 'coveralls'

  SimpleCov.formatter = Coveralls::SimpleCov::Formatter
  SimpleCov.start
rescue LoadError
  # SimpleCov missing, so just run specs with no coverage.
end

Faraday::Adapter.load_middleware(:test)

module Faraday
  class Connection
    def verify
      if app.kind_of?(Faraday::Adapter::Test)
        app.stubs.verify_stubbed_calls
      else
        raise TypeError, "Expected test adapter"
      end
    end
  end
end

module ConnectionHelpers
  def stub_connection(&block)
    stubs = Faraday::Adapter::Test::Stubs.new do |stub|
      block.call(stub)
    end
    connection = Faraday.new do |builder|
      builder.options.params_encoder = Faraday::FlatParamsEncoder
      builder.adapter(:test, stubs)
    end
  end
end

module JSONMatchers
  class EqualsJson
    def initialize(expected)
      @expected = JSON.parse(expected)
    end
    def matches?(target)
      @target = JSON.parse(target)
      @target.eql?(@expected)
    end
    def failure_message
      "expected #{@target.inspect} to be #{@expected}"
    end
    def negative_failure_message
      "expected #{@target.inspect} not to be #{@expected}"
    end
  end

  def be_json(expected)
    EqualsJson.new(expected)
  end
end

RSpec.configure do |config|
end

Version data entries

13 entries across 13 versions & 3 rubygems

Version Path
arvados-google-api-client-0.8.7.8 spec/spec_helper.rb
arvados-google-api-client-0.8.7.7 spec/spec_helper.rb
arvados-google-api-client-0.8.7.6 spec/spec_helper.rb
arvados-google-api-client-0.8.7.5 spec/spec_helper.rb
arvados-google-api-client-0.8.7.4 spec/spec_helper.rb
arvados-google-api-client-0.8.7.3 spec/spec_helper.rb
arvados-google-api-client-0.8.7.2 spec/spec_helper.rb
cure-google-api-client-0.8.7.1 spec/spec_helper.rb
google-api-client-0.8.7 spec/spec_helper.rb
google-api-client-0.8.6 spec/spec_helper.rb
google-api-client-0.8.5 spec/spec_helper.rb
google-api-client-0.8.4 spec/spec_helper.rb
google-api-client-0.8.3 spec/spec_helper.rb