Ruby on Rails Wednesday, June 22, 2016

It's really easy, the remedy is to write a test everytime you find a new error condition, and then have your method satisfy that test.

If you are not writing a test everytime you are attempting to handle an identifiable user error, what are you doing exactly? How are you solving the error without making sure that the error handler works?

If you can't test the error conditions that you are anticipating, you might not want to rescue from them.

Additionally, it sounds like you are being far too accepting with your API. Have some rules about what input types you accept, and leave it at that. If there's the need to process another input type, you can always provide another
function that decorates your original after converting the type appropriately. There's a difference between a "user" who is a developer ( I would argue that is not a user ), and an actual "user" of your website or program.


On Wed, Jun 22, 2016 at 4:13 PM, Jedrin <jrubiando@gmail.com> wrote:

 Generally when tests are written, it seems they never cover all possible cases. When you are writing code, you might sometimes think of a case where an unlikely type of input might occur so you convert it from one type to another. Even if your code has just one or two lines that don't get covered, that is enough to knock your coverage grade down considerably. If those particular cases seem unlikely then your most probably going to leave them out because you may not have time to try to cover every last unlikely user error that could happen .. That seems to be the actual reality even if not ideal ,, but I don't see any real remedy to this

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/eb44a9dc-a4ec-40ed-a142-e4b33882a11e%40googlegroups.com.

For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/CA%2BCQ936TAwze6DScdsgbU%3DtJj5R6gL_fApm-6KKXGo8pmgxoxg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment