Wednesday, February 29, 2012

Cucumber Rspec Example

After trying to wrap my head around Behavior Driven Development and getting sick of the text book example from Pragmatic Bookshelf's The Rspec Book.

I thought I should really develop something so trivial and part of my life to really understand the BDD philosophy and methodology.

So I gave a shot at the best thing I do in my life, making tea for my wife, I am pretty sure she loves my Tea because she doesn't have to do it in the early morning.

so heres how the feature file looks like

# Home Maker Morning Chores
# language: en
@good_morning @make_tea
Feature: Home Maker Prepares Tea
  In order to start a morning
  As a Home Maker of The Home
  I want to prepare Tea

  Scenario: Making Tea for 2 with Tea Bags
    Given Tea Maker
    When making 2 cups of tea
    Then add 1 cup milk
    And  add 1 Cup Water
    And add 2 spoons Sugar
    And add 4 tea bags
    Then print tea making steps

and the code is here

No comments:

Post a Comment