Sha256: ed6c28f8c9382ee1256810a058d8178b7990eebc29ce26045ac8eeda54ad5a64

Contents?: true

Size: 742 Bytes

Versions: 4

Compression:

Stored size: 742 Bytes

Contents

require File.expand_path(File.join(File.dirname(__FILE__), '../../',  'spec_helper'))

require File.expand_path(File.join(File.dirname(__FILE__), '../../../',  'lib', 'hoth', 'providers', 'rack_provider'))

describe Hoth::Providers::RackProvider do
  it "should be able to handle exceptions" do
    app = stub("ApplicationStub").as_null_object
    middleware = Hoth::Providers::RackProvider.new app
    env = {"PATH_INFO" => "/execute/some_method", "other_params" => nil}
    Rack::Request.should_receive(:new).and_raise(RuntimeError)
    
    rack_response = middleware.call env
    rack_response.first.should == 500 #status code
    rack_response.last.should match('json_class')
    rack_response.last.should match('RuntimeError')
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
hoth-0.2.2 spec/unit/providers/rack_provider_spec.rb
hoth-0.2.1 spec/unit/providers/rack_provider_spec.rb
hoth-0.1.2 spec/unit/providers/rack_provider_spec.rb
hoth-0.1.1 spec/unit/providers/rack_provider_spec.rb