[rspec-users] stepping across features

James Byrne lists at ruby-forum.com
Sun Dec 7 16:30:08 EST 2008

Andrew Premdas wrote:
> Yup, very much so IMO
> 2008/12/5 James Byrne <lists at ruby-forum.com>

Bear with me.  I am trying to see how one thing leads to another.  Say I 
have written:

  Scenario: Manual Invoice Release by Client
    Given 4 billable charges for client "Y"
    When I visit the create an invoice page
      And I search for charges belonging to client "Y"
    Then I should see a list of 4 billable charges only for client "Y"

This explicitly expresses the idea of a client.  Now, I already have an 
idea of how I want to treat a client but I want to have the emerging 
features drive that expression.  So in my step definitions file should I 
write something along the lines of:

When /visit the create an invoice page/ do
  visits "/invoices/new"

When /search for (\d+) charges belonging to client "(.*)"/ do |b,c|
  # TODO: create a client c
  # TODO: create b charges for client c
  fill_in("Client Name", :with => c)
  click_button("Find Charges")
  # TODO: my_client = Client.find_by_name(c)
  # TODO: visit "/clients/#{my_client.id}/charges/billable"

When /see a list of all (.*) only for client (.*)/ do |what,who|

Now, the sixty-four thousand dollar question, what feature or features 
should be expressed next?  The invoice?
Posted via http://www.ruby-forum.com/.

More information about the rspec-users mailing list