Sha256: 3bd3dde91862cc91bbcf272ce23b4df1ed0155bf0d10569c716949827c21cdde

Contents?: true

Size: 826 Bytes

Versions: 20

Compression:

Stored size: 826 Bytes

Contents

# encoding: utf-8

require 'spec_helper'

describe Hyperdrive::Middleware::RequestMethod do
  def app
    inner_app = ->(env) { [200, {}, ['']] }
    Hyperdrive::Middleware::RequestMethod.new(inner_app)
  end

  before do
    @resource = default_resource
    @env = default_rack_env(@resource)
  end

  it "is successful if the request method is supported" do
    get '/', {}, @env
    last_response.successful?.must_equal true
  end

  it "throws an error if hyperdrive doesn't support the request method" do
    ->{ request('/', @env.merge('REQUEST_METHOD' => 'TRACE')) }.must_raise Hyperdrive::Errors::NotImplemented
  end

  it "throws an error if the resource doesn't support the request method" do
    ->{ post('/', {}, @env.merge('REQUEST_METHOD' => 'POST')) }.must_raise Hyperdrive::Errors::MethodNotAllowed
  end
end

Version data entries

20 entries across 20 versions & 1 rubygems

Version Path
hyperdrive-0.0.25 spec/hyperdrive/middleware/request_method_spec.rb
hyperdrive-0.0.24 spec/hyperdrive/middleware/request_method_spec.rb
hyperdrive-0.0.23 spec/hyperdrive/middleware/request_method_spec.rb
hyperdrive-0.0.22 spec/hyperdrive/middleware/request_method_spec.rb
hyperdrive-0.0.21 spec/hyperdrive/middleware/request_method_spec.rb
hyperdrive-0.0.20 spec/hyperdrive/middleware/request_method_spec.rb
hyperdrive-0.0.19 spec/hyperdrive/middleware/request_method_spec.rb
hyperdrive-0.0.18 spec/hyperdrive/middleware/request_method_spec.rb
hyperdrive-0.0.17 spec/hyperdrive/middleware/request_method_spec.rb
hyperdrive-0.0.16 spec/hyperdrive/middleware/request_method_spec.rb
hyperdrive-0.0.15 spec/hyperdrive/middleware/request_method_spec.rb
hyperdrive-0.0.14 spec/hyperdrive/middleware/request_method_spec.rb
hyperdrive-0.0.13 spec/hyperdrive/middleware/request_method_spec.rb
hyperdrive-0.0.12 spec/hyperdrive/middleware/request_method_spec.rb
hyperdrive-0.0.11 spec/hyperdrive/middleware/request_method_spec.rb
hyperdrive-0.0.10 spec/hyperdrive/middleware/request_method_spec.rb
hyperdrive-0.0.9 spec/hyperdrive/middleware/request_method_spec.rb
hyperdrive-0.0.8 spec/hyperdrive/middleware/request_method_spec.rb
hyperdrive-0.0.7 spec/hyperdrive/middleware/request_method_spec.rb
hyperdrive-0.0.6 spec/hyperdrive/middleware/request_method_spec.rb