[rspec-users] Story Runner: Readability of output with multiple params

Zach Dennis zach.dennis at gmail.com
Sat Oct 13 22:49:24 EDT 2007


On 10/13/07, David Chelimsky <dchelimsky at gmail.com> wrote:
>
> And "the user", "Joe", "works for", "Acme", "as a", "janitor"

I vote no on this.

>
> And "the user $user works for $company as a $jobtitle", "Joe", "Acme", "janitor"

If these are the two choices then this one is better, but this doesn't
feel quite right.

It seems like StoryRunner should maintain consistent and clean
readability. The argument passing nature of declaring values used in
tests at the story part (Given, When, etc.) description reduces
readability.

For another discussion it may be valuable to discuss whether or not
the story parts (Given, When, etc..) should even support do/end
blocks. I realize this kills the ability to mark things as pending in
StoryRunner, but that seems like a side effect that could be overcome.

Do/end blocks seem to add unnecessary code ugliness for the Story's
themselves. I like reading:

   Given "a user for the company acme"
   When "they login"
   Then "they see their user profile"

And not:

    Given "a user for the company", "Acme" do |company|
          # code here...
    end
    When "they login", "Joe" do |login|
        # the login code.
    end
    Then "they see their user profile" do
         #...
    end

it seems like a good idea to keep acceptance test declaration separate
from the implementation this Story's are supposed to be at a higher
level then spec examples. I like to keep them closer to customer
readable/writable myself.

Zach


More information about the rspec-users mailing list