title: Building hash from xml, error in rspec test
body: <p>I've been trying for some time now to build hash from xml response, but i keep getting this error  </p>
  
  <blockquote>
  <pre><code> Failure/Error: expect(Hash.from_xml(resp_body)).to eq({
   SyntaxError:
     ~/.rvm/rubies/ruby-2.1.2/lib/ruby/2.1.0/rexml/functions.rb:393:
  </code></pre>
    
    <p>syntax error, unexpected keyword_end, expecting end-of-input</p>
  </blockquote>
  
  <p><code>response.body</code> is  </p>
  
  <p><code>"&lt;?xml version=\"1.0\" encoding=\"UTF-8\"?&gt;&lt;response&gt; 
   &lt;txn_id&gt;123&lt;/txn_id&gt;  &lt;result&gt;0&lt;/result&gt;  &lt;comment&gt;OK&lt;/comment&gt; 
   &lt;filial&gt;1&lt;/filial&gt;  &lt;prv_txn type=\"integer\"&gt;1&lt;/prv_txn&gt;&lt;/response&gt;"</code>  </p>
  
  <p>rspec itself:</p>
  
  <pre><code>require 'rails_helper'   
  require 'active_support/core_ext/hash/conversions'  
  describe TestController do  
     it 'should invoke pay_action' do  
       do_pay_request  
       resp_body =  response.body.gsub /\n/, ''  
       expect(Hash.from_xml(resp_body)).to eq({  
                                                     response: {  
                                                         txn_id: '123456789101',  
                                                         prv_txn: '111',  
                                                         result: '0',  
                                                         comment: 'OK',  
                                                         filial: '1'  
                                                     }.stringify_keys  
                                                 }.stringify_keys)  
  
     end   
  end  
  </code></pre>
  
  <p>I'm using rvm with ruby <code>ruby 2.1.2p95 (2014-05-08 revision 45877) [x86_64-darwin13.0]</code></p>