From dchelimsky at gmail.com Fri Mar 31 20:32:22 2006 From: dchelimsky at gmail.com (David Chelimsky) Date: Fri, 31 Mar 2006 19:32:22 -0600 Subject: [Rspec-devel] self naming specs Message-ID: <57c63afe0603311732i3327edb8kc6ff62ef1057da75@mail.gmail.com> Guys, I started looking at the self-naming spec idea and there's a few complications that make me wonder whether it's really feesible. Let me know what you think: First, let's imagine a spec like this: context "An empty stack" do setup do @stack = Stack.new end specify do @stack.should.be.empty end specify do @stack.size.should.be 0 end end What we'd want this to produce would be this: An empty stack - should be empty - size should be 0 The problem is that the should helper has know way of knowing definitively whether its caller is the subject of the context (the stack) or something else, like the Fixnum resulting from @stack.size. We could, conceivably do something like this: context "An empty stack" do subject @stack = Stack.new ... end but then we start adding confusion to reduce the duplication. The self-naming spec would be a cool feature, but right now things are very, very clean. I don't want to fuck that up. Thoughts?