[rspec-devel] [ rspec-Feature Requests-13913 ] Scenario should treat no code block as & quot; pending& quot;

noreply at rubyforge.org noreply at rubyforge.org
Sun Sep 16 06:56:14 EDT 2007


Feature Requests item #13913, was opened at 2007-09-13 23:49
You can respond by visiting: 
http://rubyforge.org/tracker/?func=detail&atid=3152&aid=13913&group_id=797

Category: Story Runner
Group: None
Status: Open
Priority: 3
Submitted By: Evan Light (sleight42)
Assigned to: Nobody (None)
Summary: Scenario should treat no code block as "pending"

Initial Comment:
Currently, Scenario errors out when not supplied a body.  It should behave similarly to "describe/it" where "it" is not required to have a code block.  When a code block is not given, it is treated as pending.

This could also be extended to Given/Then/When.

Ultmately, this would have the benefit of allowing one to effectively document the entire User Story without having to furnish any code -- but still allowing Story Runner to generate documentation for it.

I'll see about supplying a patch this evening

----------------------------------------------------------------------

>Comment By: David Chelimsky (dchelimsky)
Date: 2007-09-16 10:56

Message:
The steps DO care whether they get a block, but they don't necessarily raise errors when they don't.

Essentially, the first time a specific string is passed to a step it has to have a block - and that block gets mapped to that string in a hash. The next time that string is used without a block, it uses the previously defined block:

Given "foo with", 1 do |arg|
  puts arg
end
Given "foo with", 2 

=> ...
Given foo with 1
...
Given foo with 2

----------------------------------------------------------------------

Comment By: Evan Light (sleight42)
Date: 2007-09-14 03:39

Message:
Incidentally, from perusing the code a little more, it looks
like Given/When/Then probably don't care whether they are
given code blocks.  Haven't dug into this too much yet.  Was
more interested in Scenario behavior first.

----------------------------------------------------------------------

Comment By: Evan Light (sleight42)
Date: 2007-09-14 03:37

Message:
Patch attached.  Depends upons a previous "bugfix" to the
test code that I reported and patched earlier.  Redundant as
it is included in this patch ("exception_from").

----------------------------------------------------------------------

You can respond by visiting: 
http://rubyforge.org/tracker/?func=detail&atid=3152&aid=13913&group_id=797


More information about the rspec-devel mailing list