[rspec-users] features and form filling - going declarative?

Andrew Premdas apremdas at gmail.com
Fri Nov 7 01:09:21 EST 2008


I'm working on writing features for a wizard. The wizard collects
information from a number of different forms, and you can navigate through
it in a number of ways. Anyhow one of these forms is a customer form
collecting name, and email.

In the context of the wizard I feel that the following scenarios

  Scenario:
    Given I step to customer
       And I fill in my customer details correctly

  Scenario:
    Given I step to customer
       And I fill in my customer details incorrectly
     Then I should see an error

are preferable to

  Scenario:
    Given I step to customer
       And I fill in email with fred at example.com
       And I fill in name "Fred Bloggs"

    Given I step to customer
       And I fill in email with ''
       And I fill in name "Fred Bloggs"
     Then I should see an error

    # add table for different combinations of form fields that cause errors
    # consider checking that errors are appropriate


note:  Given I step to customer is nested step doing all sorts to get to the
form

What do you think?

I'm looking for some input on this, and in particular am wondering where
should I put the more specific tests for form validation, error messages
etc. in my test hierarchy, or even if I should test them at all (could you
argue they're in built rails functionality).

All best

Andrew
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://rubyforge.org/pipermail/rspec-users/attachments/20081107/ffc0d80e/attachment.html>


More information about the rspec-users mailing list