どうも。
 GW太り真っ最中、P山です。
先日XMLRPCを使用するコマンドをThorで書いていて、
 rspecでwebmockを使おうとした際に、activesupportのto_xmlを使って、ハッシュから戻り値を生成すると、
 XMLRPCの処理できる形式のxmlが生成されず、上手くいかなかった。
require 'active_support/core_ext/hash/conversions'
require 'yaml'
describe 'add' do
    before do
      stub_request(:post, "http://api-test.com/host_add").to_return(
        { :body => YAML.load_file('spec/fixtures/test001.yml').to_xml, :status => 200 }
      )
    end
    it 'stdout check' do
      expect { Hoge::Host.new.add('ptr', '157.7.190.0/26', '157.7.190.1', 'hoge.com') }.to output(/Add Record/).to_stdout
    end
  end
end
$ bundle exec rspec spec/
 Failure/Error: server.call2(method, params)
 RuntimeError:
   Missing return value!
具体的には上記エラーがでる。
stackoverflowに同じことはまってる人がいて、
 回答を見ると、
<?xml version="1.0" encoding="UTF-8"?>
  <methodResponse>
  <params>
    <param>
      <value>
        <struct>
          <member>
            <name>wm_description</name>
            <value>manual create</value>
          </member>
…
のような形式で返す必要があるみたいで、
 僕がto_xmlで出力していたのは
<?xml version="1.0" encoding="UTF-8"?>
  <responseCode>200</responseCode>
  <responseMessage>テスト</responseMessage>
…
このような値だった。
 でもベタ書きするのダサいし、yamlでスッキリ管理したい思いがあったので、
 調べていくと、
    before do
      stub_request(:post, "http://api-test.com/host_add").to_return(
        { :body => XMLRPC::Create.new.methodResponse(true, YAML.load_file('spec/fixtures/test001.yml')), :status => 200 }
      )
    end
このように、XMLRPC::Create.new.methodResponseに対して、responseの正否とハッシュを渡してあげると、
 XMLRPCが処理できる形式のXMLが生成され、正常にテストが通るようになった。
ドキュメントに実コード書いてあればもうちょっとわかりやすそうだなぁなんて思ったけど、
 わからなかったらソース読む活動が出来たので良いハマりだったっぽい。