という名前の POST アクションを持つコントローラーがありcreate
ます。create アクションでは、 rest-client gemを使用して API への POST を行うpuntopagos gemクラス ( PuntoPagos::Request
) を使用します。
class SomeController < 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
作成アクションをテストするために、RSpec を使用して、残りのクライアントの要求と応答をスタブするにはどうすればよいですか?