title: How to test controller action that uses puntopagos and rest-client?
body: <p>I have a controller with a POST action named <code>create</code>. In the create action I use a <a href="https://github.com/acidlabs/puntopagos-ruby" rel="nofollow">puntopagos gem</a> class (<code>PuntoPagos::Request</code>) that uses the <a href="https://github.com/rest-client/rest-client" rel="nofollow">rest-client gem</a> to make a POST to an API:</p>
  
  <pre><code>class SomeController &lt; ApplicationController
  
    def create
      request = PuntoPagos::Request.new
      response = request.create
      #request.create method (another method deeper, really)
      #does the POST to the API using rest-client gem.
  
      if response.success?    
        #do something on success
      else
        #do something on error
      end
    end
  
  end
  </code></pre>
  
  <p>How can I, with RSpec, stub the rest-client request and response in order to test my create action?</p>