Neverfails

604 views
536 views

Published on

Writes the code to make your tests pass (so you don’t have to)

0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total views
604
On SlideShare
0
From Embeds
0
Number of Embeds
1
Actions
Shares
0
Downloads
0
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide

Neverfails

  1. 1. Neverfails: writes the code to make your tests pass (so you don’t have to) Claudio Baccigalupo http://github.com/claudiobThursday 11 August 2011
  2. 2. cukes.infoThursday 11 August 2011
  3. 3. cukes.infoThursday 11 August 2011
  4. 4. github.com/claudiob/neverfails/tree/railsThursday 11 August 2011
  5. 5. 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" + step definitions 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 1: Now go and create the modelThursday 11 August 2011
  6. 6. rails g model apple rake db:migrate + step definitions 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 2: Create the controller and the routeThursday 11 August 2011
  7. 7. rails g controller Apples index sed -i /get "apples/index"/ a match "/apples" => "apples#index" config/routes.rb + step definitions 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 3: Adapt the viewThursday 11 August 2011
  8. 8. echo "No apples left" >| app/views/apples/ index.html.erb + step definitions 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" Hooray!Thursday 11 August 2011
  9. 9. 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" curl http://octo.cat/4j -Ls | bashThursday 11 August 2011
  10. 10. claudiob@gmail.com github.com/claudiobThursday 11 August 2011

×