I’m trying to write a test that checks to see if an error was returned if a value sent with Capybara was invalid. The problem is, one of my form fields is a <select> field, and I want to ensure that an invalid input will result in a form error.
Problem is, I can only select the fields that are existing in the select box, all of which are “valid” according to my model’s validation. I want to select an invalid field or somehow input some invalid data so that I can test for an error message.
How would I do this?
The solution as mentioned in the comments — test the model instead of doing it in an integration test. Thanks MrDanA and apneadiving!