[rspec-users] New Style: describe-it instead of context-specify
bhelmkamp at gmail.com
Sun Mar 25 17:20:07 EDT 2007
I'm a bit uncomfortable with the new describe/it syntax, and I'm
hoping someone can help me put aside my reservations...
Basically, using the context/specify syntax, there is room to include
additional information about the context of the set specs without
duplicating it in each spec. For example, the context would be "An
invalid credit card", and the specify blocks would be "should be
reject by the payment processor", etc. In the describe/it syntax, it
seems like I'd have to do:
it "should be rejected by the payment processor when invalid"
it "should not be chargeable when invalid"
it "should contain validation errors when invalid"
I'm concerned about the duplication of "when invalid" in the "it"
blocks. I totally understand the argument of clarity over DRY in
specs, but the new syntax seems like it requires spec writers to take
this too far to the extreme.
Does the describe syntax take an extra string param? That would
provide a solution as follows:
describe CreditCard, "when invalid" do
More information about the rspec-users