Sha256: 1df7a87da1b5bb83ff527ae51246b71a4bc567b56bbdc1d51883e7ea38ede3de

Contents?: true

Size: 636 Bytes

Versions: 8

Compression:

Stored size: 636 Bytes

Contents

# encoding: utf-8

require 'spec_helper'

describe Hyperdrive::Endpoint do
  def app
    Hyperdrive::Endpoint
  end

  before do
    sample_api
  end

  after do
    hyperdrive.send(:reset!)
  end

  it "responds to requests" do
    get '/', {}, default_rack_env(hyperdrive.resources[:thing])
    last_response.successful?.must_equal true
  end

  it "can raise an HTTPError" do
    hyperdrive do
      resource(:thing) do
        request(:get) do
          error(418, "I'M A TEAPOT")
        end
      end
    end
    ->{ get '/', {}, default_rack_env(hyperdrive.resources[:thing]) }.must_raise Hyperdrive::Errors::HTTPError
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
hyperdrive-0.0.15 spec/hyperdrive/endpoint_spec.rb
hyperdrive-0.0.14 spec/hyperdrive/endpoint_spec.rb
hyperdrive-0.0.13 spec/hyperdrive/endpoint_spec.rb
hyperdrive-0.0.12 spec/hyperdrive/endpoint_spec.rb
hyperdrive-0.0.11 spec/hyperdrive/endpoint_spec.rb
hyperdrive-0.0.10 spec/hyperdrive/endpoint_spec.rb
hyperdrive-0.0.9 spec/hyperdrive/endpoint_spec.rb
hyperdrive-0.0.8 spec/hyperdrive/endpoint_spec.rb