When I rename a column, how do I ensure my views aren't referencing the column by the old name in my test suite?
I encountered a situation where I've renamed 开发者_如何学JAVAa column, but was unaware that my views were still referencing the column by the old name.
This broke my web app, and I pushed these changes to my production server, thus learning the importance of a test suite.
I'm new to testing, so, I'm wondering: how I can catch problems caused by this kind of scenario?
Simple: Use the view in one of your tests. After the rename, the test will fail.
After some research I found this article. It explains functional tests, which is what I need to test my views/actions.
The documentation on rails functional testing seems poor, but the article I linked to above is exactly what I was looking for.
I just didn't understand where/how views are supposed to be tested, alas, in the functional tests.
精彩评论