Sha256: c7385309fea7f894732eb67104348f82993b9006c95856b6e43c1cbd5e3af8b6

Contents?: true

Size: 1.09 KB

Versions: 15

Compression:

Stored size: 1.09 KB

Contents

class SiteHub
  module Middleware
    describe ErrorHandling do
      describe '#call' do
        subject(:app) do
          app = proc { raise }
          described_class.new(app)
        end
        context 'it fails' do
          before do
            WebMock.disable!
          end
          it 'adds an error to be logged' do
            env = { ERRORS.to_s => [] }
            get('/', {}, env)
            expect(last_request.env[ERRORS]).to_not be_empty
          end

          describe 'parameters to callback' do
            it 'calls the callback with an error response' do
              expect(described_class::ERROR_RESPONSE).to receive(:dup).and_return(described_class::ERROR_RESPONSE)
              env = { ERRORS.to_s => [] }
              get('/', {}, env)

              expect(last_response.body).to eq(described_class::ERROR_RESPONSE.body.join)
              expect(last_response.headers).to eq(described_class::ERROR_RESPONSE.headers)
              expect(last_response.status).to eq(described_class::ERROR_RESPONSE.status)
            end
          end
        end
      end
    end
  end
end

Version data entries

15 entries across 15 versions & 1 rubygems

Version Path
sitehub-0.5.0.alpha12 spec/sitehub/middleware/error_handling_spec.rb
sitehub-0.4.10 spec/sitehub/middleware/error_handling_spec.rb
sitehub-0.5.0.alpha11 spec/sitehub/middleware/error_handling_spec.rb
sitehub-0.5.0.alpha10 spec/sitehub/middleware/error_handling_spec.rb
sitehub-0.5.0.alpha8 spec/sitehub/middleware/error_handling_spec.rb
sitehub-0.5.0.alpha7 spec/sitehub/middleware/error_handling_spec.rb
sitehub-0.5.0.alpha6 spec/sitehub/middleware/error_handling_spec.rb
sitehub-0.5.0.alpha5 spec/sitehub/middleware/error_handling_spec.rb
sitehub-0.5.0.alpha4 spec/sitehub/middleware/error_handling_spec.rb
sitehub-0.5.0.alpha3 spec/sitehub/middleware/error_handling_spec.rb
sitehub-0.5.0.alpha2 spec/sitehub/middleware/error_handling_spec.rb
sitehub-0.4.9 spec/sitehub/middleware/error_handling_spec.rb
sitehub-0.4.8 spec/sitehub/middleware/error_handling_spec.rb
sitehub-0.4.7 spec/sitehub/middleware/error_handling_spec.rb
sitehub-0.4.6 spec/sitehub/middleware/error_handling_spec.rb