Sha256: b9252e92c8b29181a5ce9d2c05e4f44c88013188ec4aa230b2850ee5814f25cd

Contents?: true

Size: 1.03 KB

Versions: 13

Compression:

Stored size: 1.03 KB

Contents

require 'spec_helper'
require 'wash_out/middleware'
require 'rexml/document'

describe WashOut::Middleware do
  it 'handles Rack environment variables' do
    err = begin
      REXML::Document.new '<hi>'
    rescue REXML::ParseException => e
      e
    end

    env = {}
    lambda {
      WashOut::Middleware.raise_or_render_rexml_parse_error err, env
    }.should raise_exception

    env['HTTP_SOAPACTION'] = 'pretend_action'
    env['rack.errors'] = double 'logger', {:puts => true} 
    env['rack.input'] = double 'basic-rack-input', {:string => '<hi>'} 
    result = WashOut::Middleware.raise_or_render_rexml_parse_error err, env
    result[0].should == 400
    result[1]['Content-Type'].should == 'text/xml'
    msg = result[2][0]
    msg.should include 'Error parsing SOAP Request XML'
    msg.should include 'soap:Fault'
    msg.should_not include __FILE__
    
    env['rack.input'] = double 'passenger-input', {:read => '<hi>'}
    result = WashOut::Middleware.raise_or_render_rexml_parse_error err, env
    result[0].should == 400
  end
end

Version data entries

13 entries across 13 versions & 1 rubygems

Version Path
wash_out-0.9.2 spec/lib/wash_out/middleware_spec.rb
wash_out-0.9.0 spec/lib/wash_out/middleware_spec.rb
wash_out-0.9.0.beta.2 spec/lib/wash_out/middleware_spec.rb
wash_out-0.9.0.beta.1 spec/lib/wash_out/middleware_spec.rb
wash_out-0.8.4 spec/lib/wash_out/middleware_spec.rb
wash_out-0.8.3 spec/lib/wash_out/middleware_spec.rb
wash_out-0.8.2 spec/lib/wash_out/middleware_spec.rb
wash_out-0.8.1 spec/lib/wash_out/middleware_spec.rb
wash_out-0.7.1 spec/lib/wash_out/middleware_spec.rb
wash_out-0.7.0 spec/lib/wash_out/middleware_spec.rb
wash_out-0.6.1 spec/lib/wash_out/middleware_spec.rb
wash_out-0.6.0 spec/lib/wash_out/middleware_spec.rb
wash_out-0.5.6 spec/lib/wash_out/middleware_spec.rb