Re:BDD with RSpec and Steak (via a real example)
by ludicast on Monday December 13, 2010 @12:31AM
(#1999465)
That's a reasonable argument but doesn't bother me because
1) I don't like the given/when/then syntax anymore (a personal thing, but I do see the advantages (Uncle Bob has a great article about it))
2) I don't mind the nesting as long as each context is making explicit what it does.
Of course it's a "different strokes" thing. I could see this not fitting in with everybody's style but for me it has DRYed up the parts of a test that should be DRY (imho).
This is why I tend to prefer the Given-When-Then style with reusable "macros" (class methods) that provide niceties such as "given_a :user", "when_i_visit root_path", etc.
Assuming that you are writing automated acceptance test, any test of more than trivial length would then be nested several levels deep.