6 ms·
I guess my question is whether that type of testing is worthwhile. It seems to create a lot of brittle test cases where renaming or moving something can cause a
by stevenwei 16y ago
I guess my question is whether that type of testing is worthwhile. It seems to create a lot of brittle test cases where renaming or moving something can cause a bunch of tests to break, creating extra maintenance overhead, while not actually telling you all that much.
- mhartl 16y agoI think people are still figuring this out. You're right that tests sometimes lock down the implementation a bit much. I'll be on the lookout for changing practices and update the tutorial accordingly.
- mhartl 16y agoI've taken a run at this, and I can't find any tests that obviously need to go. In many cases, some tests aren't strictly necessary, but they do make clearer what the code is supposed to do. Indeed, they often bring to mind the maxim from Structure and Interpretation of Computer Programs: Programs should be written for people to read, and only incidentally for machines to execute. (That's a bit of an over-statement, of course, but its spirit is true.) I also reevaluated the code for possible implementation lock-down. It looks like most such cases involve standard REST action names, such as new and show, or other aspects of the application that are unlikely to change. In the end, you'll have to develop a style that works for you. The code presented in the book is based on the style I've developed in my own work and from reading the code of others, but there are as many styles as there are Rails developers. My job is to help get you on the road to finding a style of your own.