[rspec-users] concept of given
rick.denatale at gmail.com
Tue Dec 22 11:15:53 EST 2009
On Tue, Dec 22, 2009 at 10:38 AM, David Chelimsky <dchelimsky at gmail.com> wrote:
> On Tue, Dec 22, 2009 at 9:35 AM, rogerdpack <rogerpack2005 at gmail.com> wrote:
>> Forgive me if the question is a common one...
>> does rspec have any concept like
>> given "a certain set of paths" do
>> it "should be able to recreate them" do; end
>> it "..."; end
> Not built into rspec. There is a merb extension that does that, but there is
> no "when" and "then" counterpart, so I didn't want to add it to rspec.
It looks like that merb extension was about injecting a part of a
before block by adding an option to describe, yes?
I don't see that that's what Roger is asking for though. It seems to
me that he's asking more for yet another synonym for describe or
In which case I'd suggest just using describe or context as in:
context "given a certain set of paths" do
# code to set up the paths however the included specs need them, e.g.
@paths = ["a/b", "c/d"]
it "should be able to recreate them" do; end
it "..."; end
I tend to use describe for the top level, and context when nested.
More information about the rspec-users