Topic: Brittleness of View test cases...
(Given the derth of replies to my Test::Rails thread, this might be a poor place to ask, but...)
I'm moving into finally developing some views under TDD now that I can't put it off anymore (4 completed model/controller pairs for the first interation). The surface API of the ViewTestCase in Test::Rails appears very good for driving the embedded Ruby content in the views; however I'm finding that the lack of access to the routing infrastructure is leading me to create brittle tests.
Ie the assertions like "assert_post_form", "assert_links_to" and related all want to take a constructed URL (ie /controller/action[/id]?) instead of any other the other more common forms of specifying a URL. Thus the actual format of the URL is hard-coded into a view test; while the creation of the URL in the view/helper is normally off-loaded to the routes infrastructure.
I already have exercised the applications routing in specific tests in the controller test suite and that I feel should be the single point of route testing. Now if I update a route, I'll also need to update all the view tests to avoid the avalanache of failures, not so good. I'm surprised that the ZenTest module would have overlooked this problem, so I suspect I'm missing something. The ViewTestCase code does hard-code the urls though.
Is there a reason why hard-coding the URLs in the view tests is a good thing?
(I understand, and appreciate, that separation between View and Controller tests that Test::Rails makes. And I know that the route generating code is buried in the controller layer, so I understand why giving the View Test tools access to it might be a little odd, but this negative I'm finding seems worse....)