calebhearth / formulaic

Simplify form filling with Capybara
MIT License
552 stars 29 forks source link

Better error messages when an input can't be found #64

Open derekprior opened 7 years ago

derekprior commented 7 years ago

I love the way formulaic makes my specs read when everything is working, but when I use its DSL and I'm missing some translations or I don't have the parameters quite right, it can be frustrating to figure out why. I find myself source diving formulaic to reverse engineer what went wrong.

I wonder if the InputNotFound error could be improved to return a list of inputs that were found?

calebhearth commented 7 years ago

I think it would be difficult. https://github.com/thoughtbot/formulaic/blob/00a6dac895497315e76f61369ac5d0de81afd687/lib/formulaic/inputs/string_input.rb#L4-L14 illustrates how we get around to raising InputNotFound. To build up a list of potential string inputs that were found, we'd need to combine the output of each of those to get a set of found inputs.

If you'd like to take a whack at it, I'm willing to merge something.

hovsater commented 7 years ago

I'd be up for pairing on this as well since I find myself in the same position as @derekprior more often that I'd like too. Would that be of interest? 😃