require 'spec_helper' describe 'A default soap sinatra application' do def app SoapApp end it "should parse soap request and send response" do headers = {"HTTP_SOAPACTION" => 'test'} message = 'onebarwat' post '/action', message, headers response =<<-XML one bar wat XML expect(last_response.body).to eq(response) end it "should raise soap fault on unknown action" do headers = {"HTTP_SOAPACTION" => 'test2'} message = 'onebarwat' post '/action', message, headers response =<<-XML Client Undefined Soap Action XML expect(last_response.body).to eq(response) end it "should have endpoint for soap actions" do endpoint = app.routes["POST"].select {|k| k[0].to_s.match('action')}.count expect(endpoint).to eq 1 end it "should have route for wsdl" do wsdl = app.routes["GET"].select {|k| k[0].to_s.match('wsdl')}.count expect(wsdl).to eq(1) end it "should return a usable soap views directory" do view_search = File.join(app.views, "*.builder") expect(Dir.glob(view_search).count).to be > 0 end end