Sha256: 6e7ae8e1d6be446a6015f84251831984cd999f539e3b31a0d5cffc4c209325c2

Contents?: true

Size: 1.32 KB

Versions: 1

Compression:

Stored size: 1.32 KB

Contents

require 'agrid_client'
require 'vcr'

VCR.configure do |config|
  config.cassette_library_dir = "fixtures/vcr_cassettes"
  config.hook_into :typhoeus
end

RSpec.configure do |config|
  config.expect_with :rspec do |expectations|
    expectations.include_chain_clauses_in_custom_matcher_descriptions = true
  end

  # rspec-mocks config goes here. You can use an alternate test double
  # library (such as bogus or mocha) by changing the `mock_with` option here.
  config.mock_with :rspec do |mocks|
    # Prevents you from mocking or stubbing a method that does not exist on
    # a real object. This is generally recommended, and will default to
    # `true` in RSpec 4.
    mocks.verify_partial_doubles = true
  end
end

def api_client
  conf = AgridClient::Configuration.new do |c|
    c.app_credentials = {id: '938e3405', key: '67e19c9772662859347365530aaf77be'}
  end
  AgridClient::ApiClient.new(conf)
end

def api_url(url)
  url =~ /^http/ ? url : 'http://api-staging.agrid.com.br/v1/' + url
end

def a_get(url)
  a_request(:get, api_url(url))
end

def a_post(url)
  a_request(:post, api_url(url))
end

def stub_get(url)
  stub_request(:get, api_url(url))
end

def stub_post(url)
  stub_request(:post, api_url(url))
end

def fixture_path
  File.expand_path('../fixtures', __FILE__)
end

def fixture(file)
  File.new(fixture_path + '/' + file)
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
agrid-client-0.0.4 spec/spec_helper.rb