Ranjib| there is n method/instance variable named options inside serialize, to_hash...
[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 module Faraday
8   class Connection
9     def verify
10       if app.kind_of?(Faraday::Adapter::Test)
11         app.stubs.verify_stubbed_calls
12       else
13         raise TypeError, "Expected test adapter"
14       end
15     end
16   end
17 end
18
19 module ConnectionHelpers
20   def stub_connection(&block)
21     stubs = Faraday::Adapter::Test::Stubs.new do |stub|
22       block.call(stub)
23     end
24     connection = Faraday.new do |builder|
25       builder.adapter(:test, stubs)
26     end
27   end
28 end
29
30 module JSONMatchers
31   class EqualsJson
32     def initialize(expected)
33       @expected = JSON.parse(expected)
34     end
35     def matches?(target)
36       @target = JSON.parse(target)
37       @target.eql?(@expected)
38     end
39     def failure_message
40       "expected #{@target.inspect} to be #{@expected}"
41     end
42     def negative_failure_message
43       "expected #{@target.inspect} not to be #{@expected}"
44     end
45   end
46   
47   def be_json(expected)
48     EqualsJson.new(expected)
49   end
50 end
51
52 RSpec.configure do |config|
53 end