Sha256: ad9347deaca0e922f080f81c7181f19a67a244e4bc9bf9e847f6c42405afbd3f

Contents?: true

Size: 1.01 KB

Versions: 3

Compression:

Stored size: 1.01 KB

Contents

require_relative 'fixtures'
module API
  include Spinach::DSL
  include WebMock::API
  include Spinach::Fixtures

  before do
    WebMock::Config.instance.query_values_notation = :flat_array

    stub_request(:any, /api.example.org*/).to_return(body: root_response, headers: { 'Content-Type' => 'application/hal+json' })
    stub_request(:get, 'api.example.org/posts').to_return(body: posts_response, headers: { 'Content-Type' => 'application/hal+json' })
    stub_request(:get, 'api.example.org/posts/1').to_return(body: post_response, headers: { 'Content-Type' => 'application/hal+json' })
    stub_request(:get, 'api.example.org/page2').to_return(body: page2_response, headers: { 'Content-Type' => 'application/hal+json' })
    stub_request(:get, 'api.example.org/page3').to_return(body: page3_response, headers: { 'Content-Type' => 'application/hal+json' })
  end

  def api
    @api ||= Hyperclient.new('http://api.example.org')
  end

  step 'I connect to the API' do
    api._links
  end

  after do
    WebMock.reset!
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
hyperclient-0.9.3 features/support/api.rb
hyperclient-0.9.1 features/support/api.rb
hyperclient-0.9.0 features/support/api.rb