New line characters in textareas
I’m working with a textarea where I take its input and pass it to an external service, which will validate the content.
In tests, I used webmock to stub out this external service. It worked fine with integration tests, but using Rails system tests, the stubs didn’t work.
Turns out, the default new line character in textareas, according to the HTML standard, is \r\n
. In the stubs, I used \n
.
This was somewhat unexpected. Windows also uses \r\n
as its new line character, but the tests were not passing on Mac OS X, so I didn’t think it was something related to the textarea.