changed readme to direct issue reporting on github
[arvados.git] / spec / spec_helper.rb
1 $LOAD_PATH.unshift(File.expand_path('../../lib', __FILE__))
2 $LOAD_PATH.uniq!
3
4 require 'rspec'
5 require 'faraday'
6
7 Faraday::Adapter.load_middleware(:test)
8
9 module Faraday
10   class Connection
11     def verify
12       if app.kind_of?(Faraday::Adapter::Test)
13         app.stubs.verify_stubbed_calls
14       else
15         raise TypeError, "Expected test adapter"
16       end
17     end
18   end
19 end
20
21 module ConnectionHelpers
22   def stub_connection(&block)
23     stubs = Faraday::Adapter::Test::Stubs.new do |stub|
24       block.call(stub)
25     end
26     connection = Faraday.new do |builder|
27       builder.options.params_encoder = Faraday::FlatParamsEncoder
28       builder.adapter(:test, stubs)
29     end
30   end
31 end
32
33 module JSONMatchers
34   class EqualsJson
35     def initialize(expected)
36       @expected = JSON.parse(expected)
37     end
38     def matches?(target)
39       @target = JSON.parse(target)
40       @target.eql?(@expected)
41     end
42     def failure_message
43       "expected #{@target.inspect} to be #{@expected}"
44     end
45     def negative_failure_message
46       "expected #{@target.inspect} not to be #{@expected}"
47     end
48   end
49   
50   def be_json(expected)
51     EqualsJson.new(expected)
52   end
53 end
54
55 RSpec.configure do |config|
56 end