title: Rails 4: How to test Controller Action
body: <p>How do I actually test this Controller Action, I wrote in my PurchasesController:</p>
  
  <pre><code>protect_from_forgery except: [:hook]
  def hook
      params.permit! # Permit all Paypal input params
      status = params[:payment_status]
      if status == "Completed"
          @purchase = Purchase.find(params[:invoice])
          @purchase.update_attributes(status: status, transaction_id: params[:txn_id], purchased_at: Time.now)
          @purchase.save!
          @user = @tool.user
          @user.earned_money += @tool.price
          @user.save!
      end
      render nothing: true
  end
  </code></pre>
  
  <p>preferably with my Rails Console?</p>
  
  <p>Routes:</p>
  
  <pre><code>post "/purchases/:id" =&gt; "purchases#show"
  post "/hook" =&gt; "purchases#hook"
  </code></pre>