On Fri, Jun 5, 2009 at 11:54 AM, Lee<lee.longm...@googlemail.com> wrote: > > When specifying the view, should I include examples to specify which > links should appear against an item for each potential role of a > member? Or is this going too far?
It depends. If you're doing full BDD on your view, using RSpec as a design tool to plan the view before (or while) you create it, that sounds totally appropriate. Role-based hyperlinks sound like important business features, not cosmetics or cruft, so they should be declared and tested *somewhere* for sure. If you do it this way, you should make sure you're only testing the view's code, i.e. the existence of the link, and not the logic that decides who can do what. (Which isn't the proper job for a view.) That said, view specs at a unit level tend to be a bit of a drag, and many people skip them in favor of testing views at an integration level. You could put the same tests into Cucumber, or even a Selenium or Watir browser suite, and drive it without having to set up all those mock models in the view spec. It isn't a *bad* idea to spec the views too, though. You don't lose anything but time, and you may gain that back if the operation is a sensitive one. When I make decisions about whether to test controllers or views in RSpec, I usually think about whether the code is doing anything particularly complex or unusual, or if something in it is exceptionally likely to break. (And then, if either of those is true, I think about whether I could simplify those vulnerabilities out by reexamining my assumptions.) >8-> -- Have Fun, Steve Eley (sfe...@gmail.com) ESCAPE POD - The Science Fiction Podcast Magazine http://www.escapepod.org _______________________________________________ rspec-users mailing list rspec-users@rubyforge.org http://rubyforge.org/mailman/listinfo/rspec-users