Skip to content

Instantly share code, notes, and snippets.

@r38y
Created October 21, 2008 17:02
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save r38y/18352 to your computer and use it in GitHub Desktop.
Save r38y/18352 to your computer and use it in GitHub Desktop.
require File.dirname(__FILE__) + '/../spec_helper'
require 'action_controller/integration'
# $:.unshift '/home/rlusk/projects/crm/txnew/test/mocks/test/'
# require "#{File.dirname(__FILE__)}/../test_helper"
# require 'pp'
# require 'action_controller/dispatcher'
#
# x = ActionController::Dispatcher
# module ActionController
# class Dispatcher
# alias_method :old_dispatch_cgi, :dispatch_cgi
# alias_method :old_initialize, :initialize
#
# def initialize(output)
# STDERR.puts "*"*60
# PP.pp(output, STDERR)
# STDERR.puts "*"*60
# old_initialize(output)
# end
#
# def label(text, char="*")
# "#{text} #{char*60}"
# end
#
# def dispatch_cgi(cgi, options)
# STDERR.puts label("cgi")
# PP.pp(cgi, STDERR)
# input = cgi.stdinput
# data = input.read
# STDERR.puts label("data")
# STDERR.puts data
# cgi.stdinput = StringIO.new(data)
# STDERR.puts label("options")
# PP.pp(options, STDERR)
# returning old_dispatch_cgi(cgi,options) do |results|
# STDERR.puts label("results", "=")
# PP.pp(results, STDERR)
# end
# end
# end
# end
describe SoapController do
before do
@xml = <<-EOF
<?xml version="1.0" encoding="UTF-8"?>
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<soapenv:Body>
<notifications xmlns="http://soap.sforce.com/2005/09/outbound">
<OrganizationId>00D70000000IqxMEAS</OrganizationId>
<ActionId>04k700000004DECAA2</ActionId>
<SessionId xsi:nil="true"/>
<EnterpriseUrl>https://na5-api.salesforce.com/services/Soap/c/8.0/462200D70000000IqxM</EnterpriseUrl>
<PartnerUrl>https://na5-api.salesforce.com/services/Soap/u/8.0/462200D70000000IqxM</PartnerUrl>
<Notification>
<Id>04l700000016Az5AAE</Id>
<sObject xsi:type="sf:Contact" xmlns:sf="urn:sobject.enterprise.soap.sforce.com">
<sf:Id>0037000000c024uAAA</sf:Id>
<sf:ceeb_code__c>800</sf:ceeb_code__c>
<sf:school_level__c>Secondary</sf:school_level__c>
</sObject>
</Notification>
</notifications>
</soapenv:Body>
</soapenv:Envelope>
EOF
end
describe "handling POST /soap/api" do
it "should work" do
@xml = %{<?xml version="1.0" encoding="UTF-8"?>
<document/>}
x = post(:api, @xml,
"Content-Type" => "text/xml; charset=utf-8",
"SOAPAction" => "")
puts x.inspect
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment