How can I test the send_data method in Rails?
How can I test the send_data method in Rails?
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
When I read his question I took it to mean, how does he make sure that send_data sent the string/whatever he asked it to. Not so much to test it’s sending but to ensure for his peace of mind that the method he’s sent it wasn’t blank. mocking, as you’ve done, doesn’t really get him that result.
Perhaps you can ensure that your string isn’t blank, or something like that. This way you aren’t testing send_data, but that whatever send_data gets is how you want it to look.
In my case (what brought me to this question) would be
Some fancier people use ruby debugger and sh!t… your mileage will vary.