spec/request_proxy.rb
# mocks a request to the savon client, and validates that the body xml generated
# is correct
mocks a request to the savon client, and validates that the body xml generated
is correct
mocks a request to the savon client and validates that the body xml generated is correct
def mock_request(example, client, action, attrs, response, &validate_block)
      example.mock(client).savon_client.mock!.request(*[:wsdl, action, attrs].compact) do |*args|
        block = args.last 
        ctx = RequestProxy.new()
        example.mock(ctx.http).headers.mock!["SOAPAction"]="\"#{Rews::SCHEMA_MESSAGES}/#{action}\""
        ns = Object.new
        example.mock(ctx.soap).namespaces{ns}
        example.mock(ns)["xmlns:t"]=Rews::SCHEMA_TYPES
        ctx.eval_with_delegation(&block)
        validate_block.call(ctx.soap.body) if validate_block
        response
      end
    end
def mock_request ( example , client , action , attrs , response , & validate_block ) example . mock ( client ) . savon_client . mock! . request ( * [ :wsdl , action , attrs ] . compact ) do | * args | block = args . last ctx = RequestProxy . new ( ) example . mock ( ctx . http ) . headers . mock! [ "SOAPAction" ] = "\"#{Rews::SCHEMA_MESSAGES}/#{action}\"" ns = Object . new example . mock ( ctx . soap ) . namespaces { ns } example . mock ( ns ) [ "xmlns:t" ] = Rews :: SCHEMA_TYPES ctx . eval_with_delegation ( & block ) validate_block . call ( ctx . soap . body ) if validate_block response end end
mocks a request to the savon client, and validates that the body xml generated
is correct
mocks a request to the savon client and validates that the body xml generated is correct
# deal with different call arity # block is the last arg #          mock(ctx.soap).body=(anything)
example
<not_specific>
client
<not_specific>
action
<not_specific>
attrs
<not_specific>
response
<not_specific>
validate_block
<not_specific>