I swear, Rails is gaslighting me

Blog

I add a test and run it. It fails. Fine, I walk through the code, step by step, line by line, and figure out where the error is.

I add unneeded parentheses to the return statement and run the test again. It passes. Great!

I remove the unneeded parentheses, and run the test. It fails. Okay.

I put the parentheses back in, commit the change, and create a pull request.

The reviews come in. These parentheses aren't needed.

Yes, they are, it fails without them.

Really?

Um, let me confirm.

Remove the parentheses. Run test. It passes. GDI.

Commit the changes, push the updated pull request, all the tests pass.

I look dumb for having added the extra parentheses.

Two days later, value being set is nil in an each loop. Okay, so I add a check to assign a variable only if the value being set isn't nil. Seems reasonable. Except the each never executes if the each value is nil, so the loop happens only once and the value will never be nil.

EXCEPT THAT I WALKED THAT CODE. I checked that it was running in a loop, that it was a nil value, that's why I put that check in the code in the first place. I killed spring before running that test to confirm. Remove the nil check, it is sent nil and the test fails. Put the nil check in and it isn't nil, and the test passes. UNTIL I SUBMIT A PR. Then, the nil check isn't used at all.

Twice in four days, I look like an idiot for describing what I see, even though it doesn't match what I believe should happen. Becoming rather frustrating to be gaslighted by a f'ing application framework.

And open to suggestions on how to stop this gaslighting. Maybe calling it out will help.

Add new comment