Entries Tagged 'rspec' ↓

How to Write for Valleywag: the rspec Story

The last week or so I’ve been playing with rspec, a Behavior-Driven Development framework useful for capturing user stories from which code is derived. BDD seeks to improve upon test-driven development by moving up a level, representing actual user requirements as the starting point for development, rather than starting with a specific implicit design in mind.

For my own amusement, I turned the tips for writing in the Valleywag style into an rspec plain text story:

Story: author writes a Valleywag story
  As an author
  I want to write a story
  So that it meets the Gawker criteria

  Scenario: writer expresses the rage of the creative underclass
    Given a Valleywag writer
    When writer writes a post
    Then reader should feel the expressed rage of the creative underclass

  Scenario: writer mixes a plus and a minus
    Given a Valleywag writer
    When writer writes a post
    Then post include a plus
    And post should include a minus

  Scenario: writer slams people not companies or products
    Given a Valleywag writer
    When writer writes a post
    Then post should slam people
    And post should not slam companies
    And post should not slam products

  Scenario: writer insults but is surprising
    Given a Valleywag writer
    When writer writes a post
    Then post should insult
    And reader should be surprised

  Scenario: writer doesn't let his anger get to him
    Given a Valleywag writer
    When writer writes a post
    Then post shouldn't reflect writer's anger

  Scenario: writer avoids beat-downs
    Given a Valleywag writer
    When writer writes a post
    Then post should not contain a beat-down

  Scenario: writer doesn't fisk
    Given a Valleywag writer
    When writer writes a post
    Then post should not fisk

  Scenario: writer says only things writer would say in conversation
    Given a Valleywag writer
    When writer writes a post
    Then post says only things that writer would say in conversation

  Scenario: writer avoids journalist math and uses specifics
    Given a Valleywag writer
    When writer writes a post
    Then post uses good math
    And post uses specifics

  Scenario: writer writes only one joke per post
    Given a Valleywag writer
    When writer writes a post
    Then post contains one and only one joke

  Scenario: writer bails early
    Given a Valleywag writer
    When writer writes a post
    Then post is not overly long

  Scenario: writer uses satire and parody to illustrate subject's foibles
    Given a Valleywag writer
    When writer writes a post
    Then post contains satire illustrating subject's foibles
    And post contains parody illustrating subject's foibles

  Scenario: writer never uses the word douchebag
    Given a Valleywag writer
    When writer writes a post
    Then post does not contain word douchebag