[rspec-users] stepping across features

Andrew Premdas apremdas at gmail.com
Mon Dec 8 08:38:01 EST 2008

Well assuming its correct to start simple & general start the feature
without the concept of the client

 Scenario: Manual Invoice Release
   Given 4 billable charges
    When I visit the pending invoices page
   Then I should see ... (not sure what you should see)

Now think about those charges, who do they come into existence. What are
they. Also think about the name of the page your are visiting - is it
pending invoices?

TIp: When writing the step don't use  - visits "/invoices/new" - use visits
"invoice_new_path". Use named routes and let the routing names REST and
resources define where you go, and think about what you want to implement

If you now deal with your charges, you will probably get to the stage very
quickly where you can't avoid clients. So then you do the very simplest
general thing for clients.

Generally all I'm doing here is questioning anything that is not central to
the scenario and anything that is specific. Each of these things represents
an assumption. FInding these assumptions and eliminating them will give you
something thats so simple and general that it becomes obvious (with
practice) that you can start. Then take baby steps adding new scenario's or
new whole features to bring back extra things as it becomes imperative for
you to do so. Because you have already done the simple things you should
have the tools you need (existing steps and object creators) for your next
feature. Each step you take is an iteration giving feedback and transforming
information you know from the unknown/implicit to the concrete. So before
you rush onto the next step think about what you've learnt, what you now
know. This will help you take the next step. Finally every time you find
that the baby step you are taking is actually more like a giant leap (or
actually anything other than the smallest of steps) STOP!  Then start again
questioning what is not central and what is not specific.



2008/12/7 James Byrne <lists at ruby-forum.com>

> 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"
> end
> 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"
> end
> When /see a list of all (.*) only for client (.*)/ do |what,who|
>  ...
> end
> Now, the sixty-four thousand dollar question, what feature or features
> should be expressed next?  The invoice?
> --
> Posted via http://www.ruby-forum.com/.
> _______________________________________________
> rspec-users mailing list
> rspec-users at rubyforge.org
> http://rubyforge.org/mailman/listinfo/rspec-users
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://rubyforge.org/pipermail/rspec-users/attachments/20081208/93dd653d/attachment.html>

More information about the rspec-users mailing list