Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Neverfails: writes the code to make your tests...

Neverfails: writes the code to make your tests pass (so you don’t have to)

Presented at the L.A. Ruby meetup, August 2011

Claudio B.

August 11, 2011
Tweet

More Decks by Claudio B.

Other Decks in Programming

Transcript

  1. Step 1: Now go and create the model Feature: Apples

    Scenario: No apples left Given there are no apples When I browse the list of apples Then I should see the text "No apples left" Scenario: No apples left Given there are no apples No model found called Apple. When I browse the list of apples Then I should see the text "No apples left" + step definitions
  2. Step 2: Create the controller and the route rails g

    model apple rake db:migrate Scenario: No apples left Given there are no apples When I browse the list of apples No URL pattern found matching /apples. Then I should see the text "No apples left" + step definitions
  3. Step 3: Adapt the view rails g controller Apples index

    sed -i '' ' /get "apples\/index"/ a\ match "/apples" => "apples#index" ' config/routes.rb Scenario: No apples left Given there are no apples When I browse the list of apples Then I should see the text "No apples left" The text "No apples left" was not found + step definitions
  4. Hooray! Scenario: No apples left Given there are no apples

    When I browse the list of apples Then I should see the text "No apples left" + step definitions echo "No apples left" >| app/views/apples/ index.html.erb
  5. curl http://git.io/_qrH0A -Ls | bash Feature: Bananas Scenario: No bananas

    left Given there are no bananas When I browse the list of bananas Then I should see the text "No bananas left" Neverfails Scenario: No bananas left Given there are no bananas When I browse the list of bananas Then I should see the text "No bananas left"