Question: What is unusual about this test?
Answer: They are anonymous. Jay Fields has written about why this might be a good idea, and included feedback from a bunch of people who care about this kind of thing.
The example above is from tests in Jay's validatable library. Here is a modified version of the same test:
The modified version changes several things:
Validatableat the top of the module (not shown) keeps namespaces out of the test.
Much food for thought here. How would you answer these questions?
Struct.newis more typical of real-world usage than a stub would be. A named class would be even more typical. Why would using a named class be a bad idea in languages like Ruby and Java, and what features would a language need to fix the problem?