Sha256: 0c57469c85011c7f23dc79e06d0da7dcdbd3812f9bbe9ae61156f89158ad0e91

Contents?: true

Size: 972 Bytes

Versions: 5

Compression:

Stored size: 972 Bytes

Contents

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

  before do
    stub_request(:any, %r{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

5 entries across 5 versions & 1 rubygems

Version Path
hyperclient-0.8.2 features/support/api.rb
hyperclient-0.8.1 features/support/api.rb
hyperclient-0.8.0 features/support/api.rb
hyperclient-0.7.2 features/support/api.rb
hyperclient-0.7.1 features/support/api.rb