News for hackers. Stuff that matters.
Re:Brut: A New Web Framework for Ruby by stouset on Tuesday July 08, 2025 @07:50PM (#44505051)
> My opinion is, _my unit tests_ are to protect my code against unwanted changes.

This is just about the most bizarre take on unit testing I've seen in my 25-year career.

> If I have to rewrite a method, usually I rewrite all of its unit tests.

If you have to rewrite your tests every time you rewrite a method, you are entirely defeating the point of testing. What value you get from tests that only assert that the current implementation is equal to the current implementation?

Re:Brut: A New Web Framework for Ruby by hotpocket777 on Tuesday July 08, 2025 @08:37PM (#44505282)
> This is just about the most bizarre take on unit testing I've seen in my 25-year career.

Lol ok

> you are entirely defeating the point of testing

We will disagree here

> only assert that the current implementation is equal to the current implementation

I didn’t state that I do this

Re:Brut: A New Web Framework for Ruby by 1123581321 on Tuesday July 08, 2025 @09:23PM (#44505495)
You seem confused about what he was saying. I’m sure you are familiar with unit testing philosophy with your experience. Calling a function and expecting a response does test the behavior of the application, just at a lower level than a request- or multi-request level spec. When he says rewriting a method he is referring to changing the logic of it; a refactor leaves the tests unchanged. That shouldn’t have needed to be spelled out to such a senior developer.
Re:Brut: A New Web Framework for Ruby by stouset on Wednesday July 09, 2025 @12:32AM (#44506376)
Tests should not generally need to be rewritten unless you’re changing the externally-visible behavior API of a function or library (either the literal API, its effects, or its semantics).

If you’re changing the tests because you’ve changed the internal, non-externally-visible logic of your code, your tests are almost certainly providing you negative value.

Being able to refactor and re-run your existing test suite to ensure consistent behavior is possibly the important property of a good test suite.

Re:Brut: A New Web Framework for Ruby by 1123581321 on Sunday July 13, 2025 @10:33AM (#44550729)
Yes, exactly so.