Is it necessary to use view spec even if I am using cucumber?
I think cucumber takes care of the view and the flow.So is it required to use view spec?
A l开发者_StackOverflow社区ittle explanation is appreciated..Thanks
I prefer to test everything in isolation. So I test the models, the controllers, the helpers and the views with rspec. With isolation I mean that in the controller I tend to stub out all activerecord and model methods.
With my model-, controller- and viewtests I tend to aim for complete coverage. Views is a bit harder. I like the view-tests if i want to make sure some fields are definitely shown, or some status is represented correctly. But view-tests could be very detailed, they could even test if certain elements have the correct classes. It depends on the situation or the view itself how much I really test.
I use cucumber tests to then tie everything together. Cucumber is my integration test: no stubbing there. I also use cucumber to verify my javascript in the view.
So, to answer your question: I do no think that view-testing and cucumber overlap. I use my view-tests to check that certain fields are rendered correctly. Something I do not in the same depth in cucumber. I use cucumber to go through the complete stack (integration), and to test the flow.
Hope this helps.
In my opinion, no. I keep the view as simple as I can by extracting any complexity into view helpers, which I test separately.
精彩评论