SlideShare a Scribd company logo
1 of 14
Ruby on Rails
Training Week 2

Fast Books an
Example Project

Using Behavior
Driven
Development

by Mark Menard
Enable Labs
Fast Books
 A check book ledger program.
 You will learn about:
   Behavior Driven Development
   Story Carding
   Cucumber
   RSpec
   Active Record Models
     Validation
     Associations
  Action Controller
     REST
  Active View
     ERB Templates
                                  2
Requirements
 The system should allow the management of multiple
  accounts
 The system should maintain an account ledger for
  every account in the system.
 Each account ledger should consist of ledger entries.
 Each ledger entry can be either a positive or negative
  value.
 Ledger entries can be associated with a payee and a
  category.




                                                           3
Workflow Overview
 Story card use cases
 Create a new project
 Setup RSpec and Factory Girl
 Theme the project
 Define resource using: script/generate rspec_scaffold
 Create Cucumber scenarios specifying the stories in
  the application
 Write specification for model




                                                          4
Story Carding

 Story cards are bits of narrative describing
 features of the system under development.
 They are called "cards" because in
 traditional extreme programming practice,
 they were written on paper index cards.
 The constraints of an index card were
 considered a plus -- the writing on the card
 is intended to be a marker for
 communication, not a comprehensive
 requirements document that fully describes
 the feature represented by the story.          5
Story Carding
 Every interaction with the application should have a
  story card.
 Stories should be short and too the point.
 Stories are made up of four parts:
   In order to < do some business value >
   As a < actor > on < a context >
   I want to < do something >
   Acceptance criteria




                                                         6
An Example Story Card
In order to track written checks
As a user on the account view page
I want to be able to add a check


- view account page
- click the add check button
- fill in
-- check number
-- fill in payee                     Acceptance Criteria
-- fill in amount
-- fill in category
-- fill in memo
- click submit button
- see new entry on account ledger


                                                           7
Create Initial Story Cards
 Create account
 List accounts
 View account
 Edit account
 Write a check
 Make a deposit
 Add a payee
 Add a category
 View payee report
 View category report


                             8
Behavior Driven Development
 Focus on what something should do.
 Encourages a literate style.
 Supports extraction of the specification in a readable
  format.
 Specs should be readable by domain experts.
 Specs should be executable.
 Should support testing code in isolation, integrated
  and full stack.
   When the spec runs you’re done.



                                                           9
Cucumber
 A high level behavior driven testing framework using
 plain language executable specifications.
 Feature: Contact Us
   As an anonymous user I want to be able to send a message
   So that I can receive support or get an answer to a question

   Scenario: Load Form
     Given I am on "home page"
     When I follow "Contact Us"
     Then I should see "Please use the following form"

   Scenario: Submitting form
     Given I am on the "contact us page"
     When I fill in "contact_handler[email]" with "me@example.com"
     And I fill in "contact_handler[subject]" with "Help"
     And I fill in "contact_handler[body]" with "Content"
     And I press "send"
     Then I should see "Thanks for your message."

                                                                  10
Create Initial Cucumber Scenarios
 View List Accounts Page
 Create Account
 View Account
 Edit Account




                                    11
RSpec
 RSpec provides a domain specific language with which
  you can express executable examples of the expected
  behavior of your code.
 RSpec includes support for mocking and stubbing.
 I use it as a replacement for unit and integration
  testing.
   Models and controllers




                                                     12
An RSpec Example
   You:      Describe an account when it is first created.
   Customer: It should have a balance of $0.



describe Account, "when first created" do
  it "should have a balance of $0" do
    ...
  end
end

  When you run this example, RSpec can provide a report like this:



      Account when first created
      - should have a balance of $0
                                                                     13
The Check Register Data Model




                                14

More Related Content

Viewers also liked

Startup Lessons Learned
Startup Lessons LearnedStartup Lessons Learned
Startup Lessons LearnedMark Menard
 
Conference of Grand Masters Tech Talk 2013
Conference of Grand Masters Tech Talk 2013Conference of Grand Masters Tech Talk 2013
Conference of Grand Masters Tech Talk 2013Mark Menard
 
Let's Do Some Upfront Design - WindyCityRails 2014
Let's Do Some Upfront Design - WindyCityRails 2014Let's Do Some Upfront Design - WindyCityRails 2014
Let's Do Some Upfront Design - WindyCityRails 2014Mark Menard
 
Small Code - RailsConf 2014
Small Code - RailsConf 2014Small Code - RailsConf 2014
Small Code - RailsConf 2014Mark Menard
 
JRuby in a Java World
JRuby in a Java WorldJRuby in a Java World
JRuby in a Java WorldMark Menard
 
Iuav camp presentazione
Iuav camp presentazioneIuav camp presentazione
Iuav camp presentazione01021990
 
Intro to Ruby on Rails
Intro to Ruby on RailsIntro to Ruby on Rails
Intro to Ruby on RailsMark Menard
 
Ruby on Rails Training - Module 1
Ruby on Rails Training - Module 1Ruby on Rails Training - Module 1
Ruby on Rails Training - Module 1Mark Menard
 
Intro to Rails ActiveRecord
Intro to Rails ActiveRecordIntro to Rails ActiveRecord
Intro to Rails ActiveRecordMark Menard
 

Viewers also liked (9)

Startup Lessons Learned
Startup Lessons LearnedStartup Lessons Learned
Startup Lessons Learned
 
Conference of Grand Masters Tech Talk 2013
Conference of Grand Masters Tech Talk 2013Conference of Grand Masters Tech Talk 2013
Conference of Grand Masters Tech Talk 2013
 
Let's Do Some Upfront Design - WindyCityRails 2014
Let's Do Some Upfront Design - WindyCityRails 2014Let's Do Some Upfront Design - WindyCityRails 2014
Let's Do Some Upfront Design - WindyCityRails 2014
 
Small Code - RailsConf 2014
Small Code - RailsConf 2014Small Code - RailsConf 2014
Small Code - RailsConf 2014
 
JRuby in a Java World
JRuby in a Java WorldJRuby in a Java World
JRuby in a Java World
 
Iuav camp presentazione
Iuav camp presentazioneIuav camp presentazione
Iuav camp presentazione
 
Intro to Ruby on Rails
Intro to Ruby on RailsIntro to Ruby on Rails
Intro to Ruby on Rails
 
Ruby on Rails Training - Module 1
Ruby on Rails Training - Module 1Ruby on Rails Training - Module 1
Ruby on Rails Training - Module 1
 
Intro to Rails ActiveRecord
Intro to Rails ActiveRecordIntro to Rails ActiveRecord
Intro to Rails ActiveRecord
 

Similar to Ruby on Rails Training - Module 2

Reynaldo Fadri’S Porfolio
Reynaldo Fadri’S PorfolioReynaldo Fadri’S Porfolio
Reynaldo Fadri’S Porfoliorfadri
 
Rinkeshkumar Bhagat Portfolio
Rinkeshkumar Bhagat PortfolioRinkeshkumar Bhagat Portfolio
Rinkeshkumar Bhagat PortfolioRinkeshkumar15
 
Rinkeshkumar Bhagat Portfolio
Rinkeshkumar Bhagat PortfolioRinkeshkumar Bhagat Portfolio
Rinkeshkumar Bhagat PortfolioRinkeshkumar15
 
Pay pal email guidelines 7 27-is
Pay pal email guidelines 7 27-isPay pal email guidelines 7 27-is
Pay pal email guidelines 7 27-isAudra Williams
 
Agile, User Stories, Domain Driven Design
Agile, User Stories, Domain Driven DesignAgile, User Stories, Domain Driven Design
Agile, User Stories, Domain Driven DesignAraf Karsh Hamid
 
Story Driven Development With Cucumber
Story Driven Development With CucumberStory Driven Development With Cucumber
Story Driven Development With CucumberSean Cribbs
 
Robert Parkin Portfolio
Robert Parkin PortfolioRobert Parkin Portfolio
Robert Parkin Portfoliorsparkin
 
Transforming Feature Ideas into Machine Learning Inputs
Transforming Feature Ideas into Machine Learning InputsTransforming Feature Ideas into Machine Learning Inputs
Transforming Feature Ideas into Machine Learning InputsFeatureByte
 
Using Stories to Test Requirements and Systems
Using Stories to Test Requirements and SystemsUsing Stories to Test Requirements and Systems
Using Stories to Test Requirements and SystemsPaul Gerrard
 
SetFocus SQL Portfolio
SetFocus SQL PortfolioSetFocus SQL Portfolio
SetFocus SQL Portfoliogeometro17
 
SAP BO and BODS_4+ years of exp
SAP BO and BODS_4+ years of expSAP BO and BODS_4+ years of exp
SAP BO and BODS_4+ years of expsuresh konda
 
Jazmine Kane Portfolio
Jazmine Kane PortfolioJazmine Kane Portfolio
Jazmine Kane PortfolioJazmine Kane
 
SetFocus Reporting Services Project
SetFocus Reporting Services ProjectSetFocus Reporting Services Project
SetFocus Reporting Services ProjectDavidPerley
 
The Enable Labs Way
The Enable Labs WayThe Enable Labs Way
The Enable Labs Wayjwilson2244
 
conf2015_TLaGatta_CHarris_Splunk_BusinessAnalytics_DeliveringHighLevelAnalytics
conf2015_TLaGatta_CHarris_Splunk_BusinessAnalytics_DeliveringHighLevelAnalyticsconf2015_TLaGatta_CHarris_Splunk_BusinessAnalytics_DeliveringHighLevelAnalytics
conf2015_TLaGatta_CHarris_Splunk_BusinessAnalytics_DeliveringHighLevelAnalyticsTom LaGatta
 

Similar to Ruby on Rails Training - Module 2 (20)

Reynaldo Fadri’S Porfolio
Reynaldo Fadri’S PorfolioReynaldo Fadri’S Porfolio
Reynaldo Fadri’S Porfolio
 
Rinkeshkumar Bhagat Portfolio
Rinkeshkumar Bhagat PortfolioRinkeshkumar Bhagat Portfolio
Rinkeshkumar Bhagat Portfolio
 
Rinkeshkumar Bhagat Portfolio
Rinkeshkumar Bhagat PortfolioRinkeshkumar Bhagat Portfolio
Rinkeshkumar Bhagat Portfolio
 
Pay pal email guidelines 7 27-is
Pay pal email guidelines 7 27-isPay pal email guidelines 7 27-is
Pay pal email guidelines 7 27-is
 
Agile, User Stories, Domain Driven Design
Agile, User Stories, Domain Driven DesignAgile, User Stories, Domain Driven Design
Agile, User Stories, Domain Driven Design
 
Story Driven Development With Cucumber
Story Driven Development With CucumberStory Driven Development With Cucumber
Story Driven Development With Cucumber
 
Robert Parkin Portfolio
Robert Parkin PortfolioRobert Parkin Portfolio
Robert Parkin Portfolio
 
User Stories
User StoriesUser Stories
User Stories
 
Test script
Test scriptTest script
Test script
 
LEYTON_AgileBusinessAnalystSample
LEYTON_AgileBusinessAnalystSampleLEYTON_AgileBusinessAnalystSample
LEYTON_AgileBusinessAnalystSample
 
Transforming Feature Ideas into Machine Learning Inputs
Transforming Feature Ideas into Machine Learning InputsTransforming Feature Ideas into Machine Learning Inputs
Transforming Feature Ideas into Machine Learning Inputs
 
Using Stories to Test Requirements and Systems
Using Stories to Test Requirements and SystemsUsing Stories to Test Requirements and Systems
Using Stories to Test Requirements and Systems
 
SetFocus SQL Portfolio
SetFocus SQL PortfolioSetFocus SQL Portfolio
SetFocus SQL Portfolio
 
SAP BO and BODS_4+ years of exp
SAP BO and BODS_4+ years of expSAP BO and BODS_4+ years of exp
SAP BO and BODS_4+ years of exp
 
Jazmine Kane Portfolio
Jazmine Kane PortfolioJazmine Kane Portfolio
Jazmine Kane Portfolio
 
Marcus Matthews
Marcus MatthewsMarcus Matthews
Marcus Matthews
 
SetFocus Reporting Services Project
SetFocus Reporting Services ProjectSetFocus Reporting Services Project
SetFocus Reporting Services Project
 
The Enable Labs Way
The Enable Labs WayThe Enable Labs Way
The Enable Labs Way
 
conf2015_TLaGatta_CHarris_Splunk_BusinessAnalytics_DeliveringHighLevelAnalytics
conf2015_TLaGatta_CHarris_Splunk_BusinessAnalytics_DeliveringHighLevelAnalyticsconf2015_TLaGatta_CHarris_Splunk_BusinessAnalytics_DeliveringHighLevelAnalytics
conf2015_TLaGatta_CHarris_Splunk_BusinessAnalytics_DeliveringHighLevelAnalytics
 
OLT open script
OLT open script OLT open script
OLT open script
 

Recently uploaded

MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MIND CTI
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FMESafe Software
 
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024Victor Rentea
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherRemote DBA Services
 
Elevate Developer Efficiency & build GenAI Application with Amazon Q​
Elevate Developer Efficiency & build GenAI Application with Amazon Q​Elevate Developer Efficiency & build GenAI Application with Amazon Q​
Elevate Developer Efficiency & build GenAI Application with Amazon Q​Bhuvaneswari Subramani
 
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024Victor Rentea
 
DEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 AmsterdamDEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 AmsterdamUiPathCommunity
 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...DianaGray10
 
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ..."I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...Zilliz
 
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...apidays
 
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...Jeffrey Haguewood
 
Corporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptxCorporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptxRustici Software
 
Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native ApplicationsWSO2
 
DBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDropbox
 
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWEREMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWERMadyBayot
 
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...Orbitshub
 
MS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectorsMS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectorsNanddeep Nachan
 
Vector Search -An Introduction in Oracle Database 23ai.pptx
Vector Search -An Introduction in Oracle Database 23ai.pptxVector Search -An Introduction in Oracle Database 23ai.pptx
Vector Search -An Introduction in Oracle Database 23ai.pptxRemote DBA Services
 

Recently uploaded (20)

MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
 
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a Fresher
 
Elevate Developer Efficiency & build GenAI Application with Amazon Q​
Elevate Developer Efficiency & build GenAI Application with Amazon Q​Elevate Developer Efficiency & build GenAI Application with Amazon Q​
Elevate Developer Efficiency & build GenAI Application with Amazon Q​
 
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
 
DEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 AmsterdamDEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
 
Understanding the FAA Part 107 License ..
Understanding the FAA Part 107 License ..Understanding the FAA Part 107 License ..
Understanding the FAA Part 107 License ..
 
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ..."I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
 
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
 
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
 
Corporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptxCorporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptx
 
Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native Applications
 
DBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor Presentation
 
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWEREMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
 
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
 
MS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectorsMS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectors
 
Vector Search -An Introduction in Oracle Database 23ai.pptx
Vector Search -An Introduction in Oracle Database 23ai.pptxVector Search -An Introduction in Oracle Database 23ai.pptx
Vector Search -An Introduction in Oracle Database 23ai.pptx
 

Ruby on Rails Training - Module 2

  • 1. Ruby on Rails Training Week 2 Fast Books an Example Project Using Behavior Driven Development by Mark Menard Enable Labs
  • 2. Fast Books  A check book ledger program.  You will learn about:  Behavior Driven Development  Story Carding  Cucumber  RSpec  Active Record Models  Validation  Associations  Action Controller  REST  Active View  ERB Templates 2
  • 3. Requirements  The system should allow the management of multiple accounts  The system should maintain an account ledger for every account in the system.  Each account ledger should consist of ledger entries.  Each ledger entry can be either a positive or negative value.  Ledger entries can be associated with a payee and a category. 3
  • 4. Workflow Overview  Story card use cases  Create a new project  Setup RSpec and Factory Girl  Theme the project  Define resource using: script/generate rspec_scaffold  Create Cucumber scenarios specifying the stories in the application  Write specification for model 4
  • 5. Story Carding Story cards are bits of narrative describing features of the system under development. They are called "cards" because in traditional extreme programming practice, they were written on paper index cards. The constraints of an index card were considered a plus -- the writing on the card is intended to be a marker for communication, not a comprehensive requirements document that fully describes the feature represented by the story. 5
  • 6. Story Carding  Every interaction with the application should have a story card.  Stories should be short and too the point.  Stories are made up of four parts:  In order to < do some business value >  As a < actor > on < a context >  I want to < do something >  Acceptance criteria 6
  • 7. An Example Story Card In order to track written checks As a user on the account view page I want to be able to add a check - view account page - click the add check button - fill in -- check number -- fill in payee Acceptance Criteria -- fill in amount -- fill in category -- fill in memo - click submit button - see new entry on account ledger 7
  • 8. Create Initial Story Cards  Create account  List accounts  View account  Edit account  Write a check  Make a deposit  Add a payee  Add a category  View payee report  View category report 8
  • 9. Behavior Driven Development  Focus on what something should do.  Encourages a literate style.  Supports extraction of the specification in a readable format.  Specs should be readable by domain experts.  Specs should be executable.  Should support testing code in isolation, integrated and full stack.  When the spec runs you’re done. 9
  • 10. Cucumber  A high level behavior driven testing framework using plain language executable specifications. Feature: Contact Us As an anonymous user I want to be able to send a message So that I can receive support or get an answer to a question Scenario: Load Form Given I am on "home page" When I follow "Contact Us" Then I should see "Please use the following form" Scenario: Submitting form Given I am on the "contact us page" When I fill in "contact_handler[email]" with "me@example.com" And I fill in "contact_handler[subject]" with "Help" And I fill in "contact_handler[body]" with "Content" And I press "send" Then I should see "Thanks for your message." 10
  • 11. Create Initial Cucumber Scenarios  View List Accounts Page  Create Account  View Account  Edit Account 11
  • 12. RSpec  RSpec provides a domain specific language with which you can express executable examples of the expected behavior of your code.  RSpec includes support for mocking and stubbing.  I use it as a replacement for unit and integration testing.  Models and controllers 12
  • 13. An RSpec Example You: Describe an account when it is first created. Customer: It should have a balance of $0. describe Account, "when first created" do it "should have a balance of $0" do ... end end When you run this example, RSpec can provide a report like this: Account when first created - should have a balance of $0 13
  • 14. The Check Register Data Model 14

Editor's Notes

  1. \n
  2. \n
  3. \n
  4. \n
  5. \n
  6. \n
  7. \n
  8. \n
  9. \n
  10. \n
  11. \n
  12. \n
  13. \n
  14. \n