ruby on rails - Rspec, sham_rack and Savon 2 -


i trying update our savon (from version 1) version 2. have feature test loads page hits method fires savon. savon seems work fine.

however, have support file using sham_rack intercept request , return default info. works fine in savon v1, not v2. doesn't seem trigger @ all, , not sure if it's wrong code, sham_rack, or savon.

# savon call def client   @client ||= savon.client     settings.savon # yml file, stuff turning on logging, etc     endpoint    'http://www.site.local/someservice.svc?wsdl=wsdl10'     namespace   'http://www.somesite.com/url/1.0'     namespaces  'xmlns:ns' => 'http://www.somesite.com/url/1.0',                 'xmlns:arr' => 'http://schemas.microsoft.com/2003/10/serialization/arrays'     pretty_print_xml true   end end  # here action 'getallitems' def do_collections_server_request(body, action, options = {})   options.reverse_merge!(raise_errors: true)    client.globals.raise_errors(options[:raise_errors])   client.globals.headers('soapaction' => "http://www.somesite.com/url/1.0/iservice/#{action}")    client.call(action, message: body) end 
# spec/support/sham_calls.rb require 'nokogiri'  shamrack.at('www.site.local').sinatra   post '/someservice.svc'     if request.env['http_soapaction'].include? 'getallitems'       return prepared_xml     end   end end 

i can put message right @ start of shamrack.at block, , fires when loads. doesn't seem ever trigger post. works fine savon 1 (except changes had make make savon work, of course). , seems post fine endpoint. shamrack isn't grabbing it. doing wrong?

ruby 2.1.1

gems:

rails (3.2.18) sham_rack (1.3.6) savon (2.3.3)       akami (~> 1.2.0)       builder (>= 2.1.2)       gyoku (~> 1.1.0)       httpi (~> 2.1.0)       nokogiri (>= 1.4.0)       nori (~> 2.3.0)       wasabi (~> 3.2.2) 

after lot of investigation, believe savon might running in different thread. shamrack says:

what's catch? rack request-handling code runs in same ruby vm, in fact same thread, request.

i believe why savon requests not caught sinatra. have 1 other more direct call out our app, , shamrack still catches this.

in end, moved vcr solve issue.

if else has solution love hear it, don't know have time fix moving forward vcr.


Comments

Popular posts from this blog

php - render data via PDO::FETCH_FUNC vs loop -

c++ - OpenCV Error: Assertion failed <scn == 3 ::scn == 4> in unknown function, -

The canvas has been tainted by cross-origin data in chrome only -