class SessionsController < ApplicationController::Base
def create
result = verify_sms_code(params[:session][:phone], params[:session][:code]
if result['code'] == 200
render json: {code: 200, msg: 'success'}
else
render json: {code: 404, msg: 'failed'}
end
end
end
I want to mock verify_sms_code method returns JSON result,e.g {'code':200,
data:'correct'} or {'code':404, data:'incorrect'} ,how can I test this
action with verify_sms_code method different return values? Thanks!
--
You received this message because you are subscribed to the Google Groups
"rspec" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/rspec/848b2139-5848-4b41-a471-6c42085fe5df%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.