SlideShare a Scribd company logo
1 of 43
Download to read offline
How I Roll:
A Cucumber/git
  Workflow
 Matt Buck, Capital Thought
We make




Capital Thought

                        I work for
Agenda

• Creating topic branches in git
• Outside-In model of Rails development
• Merging topic branches
• BONUS ROUND: Getting non-technical
  stakeholders involved
$ issue list
    3. Administrators should be able to manage Users
    4. Access should be restricted by Role
    6. Users should be able to edit account settings
    7. Administrators should be able to import Contacts
   13. Authors should be able to manage Posts
   14. Authors should be able to register
$ issue list
    3. Administrators should be able to manage Users
    4. Access should be restricted by Role
    6. Users should be able to edit account settings
    7. Administrators should be able to import Contacts
   13. Authors should be able to manage Posts
   14. Authors should be able to register
$ git checkout -b
13_authors_manage_posts
Outside-in Rails development
• Write a scenario
• Execute the scenario
• Write a step definition
• red/green/refactor View
• red/green/refactor Controller
  • ensure the proper instance variables are
    assigned

•   red/green/refactor Models

    •   ensure they provide methods needed by View
        and Controller
•   Write a step definition
•   red/green/refactor View
•   red/green/refactor Controller
•   red/green/refactor Model
Feature: author manages posts
  As an author
  I want to be able to manage the posts on my blog
  So that my audience can read my content

  Background:
    Given I am logged in as the following active author account:
      | Name | Email address    | Password | Phone number | Fax number   |
      | John | john@myvenue.com | pass     | 555-555-1212 | 555-555-1213 |

  Scenario: Author adds a new post
    When I am on the create post page for John
    When I fill in the form with the following values:
      | Title      | Body         |
      | First post | Hello, blog! |
    And I press "Add post"
    Then I should be on the show post page for "First post"
    And I should see "Your post has been added."
    And I should see "First post"
    And I should see "Hello, blog!"
    And there should be a new post with the title "First post"
Outside-in Rails development
• Write a scenario
• Execute the scenario
• Write a step definition
• red/green/refactor View
• red/green/refactor Controller
  • ensure the proper instance variables are
    assigned

•   red/green/refactor Models

    •   ensure they provide methods needed by View
        and Controller
Feature: author manages posts
  As an author
  I want to be able to manage the posts on my blog
  So that my audience can read my content

 Background:
   Given I am logged in as the following active author account:
     | Name | Email address    | Password | Phone number | Fax number   |
     | John | john@myvenue.com | pass     | 555-555-1212 | 555-555-1213 |

 Scenario: Author adds a new post
   When I am on the create post page for John
   When I fill in the form with the following values:
     | Title      | Body          |
     | First post | Hello, blog! |
   And I press "Add post"
   Then I should be on the show post page for "First post"
   And I should see "Your post has been added."
   And I should see "First post"
   And I should see "Hello, blog!"
   And there should be a new post with the title "First post"
features/env/paths.rb

when /the create post page for (.*)$/
  author = Author.find_by_name($1)
  new_author_post_path(author)
Feature: author manages posts
  As an author
  I want to be able to manage the posts on my blog
  So that my audience can read my content

 Background:
   Given I am logged in as the following active author account:
     | Name | Email address    | Password | Phone number | Fax number   |
     | John | john@myvenue.com | pass     | 555-555-1212 | 555-555-1213 |

 Scenario: Author adds a new post
   When I am on the create post page for John
   When I fill in the form with the following values:
     | Title      | Body          |
     | First post | Hello, blog! |
   And I press "Add post"
   Then I should be on the show post page for "First post"
   And I should see "Your post has been added."
   And I should see "First post"
   And I should see "Hello, blog!"
   And there should be a new post with the title "First post"
Outside-in Rails development
• Write a scenario
• Execute the scenario
• Write a step definition
• red/green/refactor View
• red/green/refactor Controller
  • ensure the proper instance variables are
    assigned

•   red/green/refactor Models

    •   ensure they provide methods needed by View
        and Controller
spec/views/posts/new.html.haml_spec.rb

describe "/posts/new.html.haml" do
  before(:each) do
    assigns[:post] = Factory.build :post
    @author = Factory.create :author
    assigns[:author] = @author
  end

  it "should render new form" do
    render "/events/new.html.haml"
    response.should have_tag("form[action=?][method=post]",
author_posts_path(@author))
  end
end

app/views/posts/new.html.haml

%h1 New post

- form_for([@author, @post]) do |f|
  = render :partial => "form", :locals => {:f => f}

  %p= f.submit "Add Post"
Feature: author manages posts
  As an author
  I want to be able to manage the posts on my blog
  So that my audience can read my content

 Background:
   Given I am logged in as the following active author account:
     | Name | Email address    | Password | Phone number | Fax number   |
     | John | john@myvenue.com | pass     | 555-555-1212 | 555-555-1213 |

 Scenario: Author adds a new post
   When I am on the create post page for John
   When I fill in the form with the following values:
     | Title      | Body          |
     | First post | Hello, blog! |
   And I press "Add post"
   Then I should be on the show post page for "First post"
   And I should see "Your post has been added."
   And I should see "First post"
   And I should see "Hello, blog!"
   And there should be a new post with the title "First post"
Outside-in Rails development
• Write a scenario
• Execute the scenario
• Write a step definition
• red/green/refactor View
• red/green/refactor Controller
  • ensure the proper instance variables
    are assigned

•   red/green/refactor Models

    •   ensure they provide methods needed by View
        and Controller
spec/controllers/posts_controller_spec.rb

describe "responding to GET new" do
  def do_get(params = {})
    stub_author
    get :new, {:author_id => @author}
  end

  it "should expose a new post as @post" do
    post = Factory.build(:post)
    Post.should_receive(:new).and_return(post)
    do_get
    assigns[:post].should equal(post)
  end
end

app/controllers/posts_controller.rb

def new
  @post = Post.new(params[:post])

  respond_to do |format|
    format.html # new.html.erb
    format.xml { render :xml => @post }
  end
end
Feature: author manages posts
  As an author
  I want to be able to manage the posts on my blog
  So that my audience can read my content

 Background:
   Given I am logged in as the following active author account:
     | Name | Email address    | Password | Phone number | Fax number   |
     | John | john@myvenue.com | pass     | 555-555-1212 | 555-555-1213 |

 Scenario: Author adds a new post
   When I am on the create post page for John
   When I fill in the form with the following values:
     | Title      | Body          |
     | First post | Hello, blog! |
   And I press "Add post"
   Then I should be on the show post page for "First post"
   And I should see "Your post has been added."
   And I should see "First post"
   And I should see "Hello, blog!"
   And there should be a new post with the title "First post"
features/env/paths.rb

when /the (create|show) post page for (.*)$/
  author = Author.find_by_name($2)‚Ä®

  case $1
  when /create/
    new_author_post_path(author)
  when /show/
    autho_post_path(author)
Feature: author manages posts
  As an author
  I want to be able to manage the posts on my blog
  So that my audience can read my content

 Background:
   Given I am logged in as the following active author account:
     | Name | Email address    | Password | Phone number | Fax number   |
     | John | john@myvenue.com | pass     | 555-555-1212 | 555-555-1213 |

 Scenario: Author adds a new post
   When I am on the create post page for John
   When I fill in the form with the following values:
     | Title      | Body          |
     | First post | Hello, blog! |
   And I press "Add post"
   Then I should be on the show post page for "First post"
   And I should see "Your post has been added."
   And I should see "First post"
   And I should see "Hello, blog!"
   And there should be a new post with the title "First post"
spec/controllers/posts_controller_spec.rb

it "should redirect to the created post" do
  Post.stub!(:new).and_return(@new_post)
  post :create, :post => {}
  response.should redirect_to(author_post_url(@author, @new_post))
end

app/controllers/posts_controller.rb

# POST /posts
# POST /posts.xml
def create
  @post = @author.posts.new(params[:post])

  respond_to do |format|
    if @post.save
      flash[:notice] = 'Post was successfully created.'
      redirect_to author_post_url(@author, @post)
    else
      render :action => "new"
    end
  end
end
Feature: author manages posts
  As an author
  I want to be able to manage the posts on my blog
  So that my audience can read my content

 Background:
   Given I am logged in as the following active author account:
     | Name | Email address    | Password | Phone number | Fax number   |
     | John | john@myvenue.com | pass     | 555-555-1212 | 555-555-1213 |

 Scenario: Author adds a new post
   When I am on the post creation page for John
   When I fill in the form with the following values:
     | Title       | Body          |
     | First post! | Hello, blog! |
   And I press "Add post"
   Then I should be on the show post page for "First post"
   And I should see "Your post has been added."
   And I should see "First post"
   And I should see "Hello, blog!"
   And there should be a new post with the title "First post"
Fast forward...
Feature: author manages posts
  As an author
  I want to be able to manage the posts on my blog
  So that my audience can read my content

 Background:
   Given I am logged in as the following active author account:
     | Name | Email address    | Password | Phone number | Fax number   |
     | John | john@myvenue.com | pass     | 555-555-1212 | 555-555-1213 |

 Scenario: Author adds a new post
   When I am on the post creation page for John
   When I fill in the form with the following values:
     | Title      | Body          |
     | First post | Hello, blog! |
   And I press "Add post"
   Then I should be on the show post page for “First Post”
   And I should see "Your post has been added."
   And I should see "First post"
   And I should see "Hello, blog!"
   And there should be a new post with the title "First post"
Feature: author manages posts
  As an author
  I want to be able to manage the posts on my blog
  So that my audience can read my content

 Background:
   Given I am logged in as the following active author account:
     | Name | Email address    | Password | Phone number | Fax number   |
     | John | john@myvenue.com | pass     | 555-555-1212 | 555-555-1213 |

 Scenario: Author adds a new post
   When I am on the post creation page for John
   When I fill in the form with the following values:
     | Title      | Body          |
     | First post | Hello, blog! |
   And I press "Add post"
   Then I should be on the show post page for “First Post”
   And I should see "Your post has been added."
   And I should see "First post"
   And I should see "Hello, blog!"
   And I should see "This post contains 22 characters"
   And there should be a new post with the title "First post"
spec/views/posts/show.html.haml_spec.rb

describe "/posts/show.html.haml" do
  before(:each) do
    @post   = Factory.create :post
    @author = Factory.create :author
    assigns[:author] = @author
    assigns[:post]   = @post
    @post.stub!(:total_length).and_return(24)
  end

  it "should display the length of the post in characters" do
    render "/events/show.html.haml"
    response.should have_tag("span#length", :text => 24)
  end
end

app/views/posts/new.html.haml

%h1= @post.title

%span#length= @post.total_length
spec/models/post_spec.rb

it "should return the length of the body and title in characters" do
  post = Post.create :title => "Title", :body => "Body"
  post.total_length.should == 9
end

spec/models/post.rb

def total_length
  title.size + body.size
end
Feature: author manages posts
  As an author
  I want to be able to manage the posts on my blog
  So that my audience can read my content

 Background:
   Given I am logged in as the following active author account:
     | Name | Email address    | Password | Phone number | Fax number   |
     | John | john@myvenue.com | pass     | 555-555-1212 | 555-555-1213 |

 Scenario: Author adds a new post
   When I am on the post creation page for John
   When I fill in the form with the following values:
     | Title      | Body          |
     | First post | Hello, blog! |
   And I press "Add post"
   Then I should be on the show post page for “First Post”
   And I should see "Your post has been added."
   And I should see "First post"
   And I should see "Hello, blog!"
   And I should see "This post contains 22 characters"
   And there should be a new post with the title "First post"
$ git checkout master
$ git merge --squash 13_authors_manage_posts
$ git commit -m “Implemented <...> Closes #13”
$ git checkout master
$ git merge --squash 13_authors_manage_posts
$ git commit -m “Implemented <...> Closes #13”
$ git checkout master
$ git merge 13_authors_manage_posts
Bonus Round
How do we get
     non-technical
stakeholders involved in
   the story creation
        process?
Credits, etc.

• Cucumber roll image: http://www.flickr.com/
  photos/stuart_spivack/464718611/
• Github Issues CLI: http://github.com/jsmits/
  github-cli/tree/master
• The RSpec Book: http://www.pragprog.com/
  titles/achbd/the-rspec-book

More Related Content

What's hot

Enter the app era with ruby on rails (rubyday)
Enter the app era with ruby on rails (rubyday)Enter the app era with ruby on rails (rubyday)
Enter the app era with ruby on rails (rubyday)Matteo Collina
 
How we improved performance at Mixbook
How we improved performance at MixbookHow we improved performance at Mixbook
How we improved performance at MixbookAnton Astashov
 
Enter the app era with ruby on rails
Enter the app era with ruby on railsEnter the app era with ruby on rails
Enter the app era with ruby on railsMatteo Collina
 
Behat, Test Driven Framework for BDD by Jeevan Bhushetty
Behat, Test Driven Framework for BDD by Jeevan BhushettyBehat, Test Driven Framework for BDD by Jeevan Bhushetty
Behat, Test Driven Framework for BDD by Jeevan BhushettyAgile Testing Alliance
 
Rapi::Blog talk - TPC 2017
Rapi::Blog talk - TPC 2017Rapi::Blog talk - TPC 2017
Rapi::Blog talk - TPC 2017Henry Van Styn
 
Outside-in Development with Cucumber and Rspec
Outside-in Development with Cucumber and RspecOutside-in Development with Cucumber and Rspec
Outside-in Development with Cucumber and RspecJoseph Wilk
 
Teaming up WordPress API with Backbone.js in Titanium
Teaming up WordPress API with Backbone.js in TitaniumTeaming up WordPress API with Backbone.js in Titanium
Teaming up WordPress API with Backbone.js in TitaniumJeroen van Dijk
 
A Universal Automation Framework based on BDD Cucumber and Ruby on Rails - Ph...
A Universal Automation Framework based on BDD Cucumber and Ruby on Rails - Ph...A Universal Automation Framework based on BDD Cucumber and Ruby on Rails - Ph...
A Universal Automation Framework based on BDD Cucumber and Ruby on Rails - Ph...Ho Chi Minh City Software Testing Club
 
Behavior Driven Development - How To Start with Behat
Behavior Driven Development - How To Start with BehatBehavior Driven Development - How To Start with Behat
Behavior Driven Development - How To Start with Behatimoneytech
 
Ruby conf 2011, Create your own rails framework
Ruby conf 2011, Create your own rails frameworkRuby conf 2011, Create your own rails framework
Ruby conf 2011, Create your own rails frameworkPankaj Bhageria
 
RubyConf Bangladesh 2017 - Elixir for Rubyists
RubyConf Bangladesh 2017 - Elixir for RubyistsRubyConf Bangladesh 2017 - Elixir for Rubyists
RubyConf Bangladesh 2017 - Elixir for RubyistsRuby Bangladesh
 
RapidApp - YAPC::NA 2014
RapidApp - YAPC::NA 2014RapidApp - YAPC::NA 2014
RapidApp - YAPC::NA 2014Henry Van Styn
 
Testing ASP.net Web Applications using Ruby
Testing ASP.net Web Applications using RubyTesting ASP.net Web Applications using Ruby
Testing ASP.net Web Applications using RubyBen Hall
 
Building WordPress Client Side Applications with WP and WP-API - #wcmia
Building WordPress Client Side Applications with WP and WP-API - #wcmiaBuilding WordPress Client Side Applications with WP and WP-API - #wcmia
Building WordPress Client Side Applications with WP and WP-API - #wcmiaRoy Sivan
 
Action View Form Helpers - 1, Season 2
Action View Form Helpers - 1, Season 2Action View Form Helpers - 1, Season 2
Action View Form Helpers - 1, Season 2RORLAB
 
How to build Client Side Applications with WordPress and WP-API | #wcmia
How to build Client Side Applications with WordPress and WP-API | #wcmiaHow to build Client Side Applications with WordPress and WP-API | #wcmia
How to build Client Side Applications with WordPress and WP-API | #wcmiaRoy Sivan
 
Rails 2.3 and Rack - NHRuby Feb 2009
Rails 2.3 and Rack - NHRuby Feb 2009Rails 2.3 and Rack - NHRuby Feb 2009
Rails 2.3 and Rack - NHRuby Feb 2009bturnbull
 
Associations & JavaScript
Associations & JavaScriptAssociations & JavaScript
Associations & JavaScriptJoost Elfering
 
Using Angular with Rails
Using Angular with RailsUsing Angular with Rails
Using Angular with RailsJamie Davidson
 

What's hot (20)

Enter the app era with ruby on rails (rubyday)
Enter the app era with ruby on rails (rubyday)Enter the app era with ruby on rails (rubyday)
Enter the app era with ruby on rails (rubyday)
 
BDD with cucumber
BDD with cucumberBDD with cucumber
BDD with cucumber
 
How we improved performance at Mixbook
How we improved performance at MixbookHow we improved performance at Mixbook
How we improved performance at Mixbook
 
Enter the app era with ruby on rails
Enter the app era with ruby on railsEnter the app era with ruby on rails
Enter the app era with ruby on rails
 
Behat, Test Driven Framework for BDD by Jeevan Bhushetty
Behat, Test Driven Framework for BDD by Jeevan BhushettyBehat, Test Driven Framework for BDD by Jeevan Bhushetty
Behat, Test Driven Framework for BDD by Jeevan Bhushetty
 
Rapi::Blog talk - TPC 2017
Rapi::Blog talk - TPC 2017Rapi::Blog talk - TPC 2017
Rapi::Blog talk - TPC 2017
 
Outside-in Development with Cucumber and Rspec
Outside-in Development with Cucumber and RspecOutside-in Development with Cucumber and Rspec
Outside-in Development with Cucumber and Rspec
 
Teaming up WordPress API with Backbone.js in Titanium
Teaming up WordPress API with Backbone.js in TitaniumTeaming up WordPress API with Backbone.js in Titanium
Teaming up WordPress API with Backbone.js in Titanium
 
A Universal Automation Framework based on BDD Cucumber and Ruby on Rails - Ph...
A Universal Automation Framework based on BDD Cucumber and Ruby on Rails - Ph...A Universal Automation Framework based on BDD Cucumber and Ruby on Rails - Ph...
A Universal Automation Framework based on BDD Cucumber and Ruby on Rails - Ph...
 
Behavior Driven Development - How To Start with Behat
Behavior Driven Development - How To Start with BehatBehavior Driven Development - How To Start with Behat
Behavior Driven Development - How To Start with Behat
 
Ruby conf 2011, Create your own rails framework
Ruby conf 2011, Create your own rails frameworkRuby conf 2011, Create your own rails framework
Ruby conf 2011, Create your own rails framework
 
RubyConf Bangladesh 2017 - Elixir for Rubyists
RubyConf Bangladesh 2017 - Elixir for RubyistsRubyConf Bangladesh 2017 - Elixir for Rubyists
RubyConf Bangladesh 2017 - Elixir for Rubyists
 
RapidApp - YAPC::NA 2014
RapidApp - YAPC::NA 2014RapidApp - YAPC::NA 2014
RapidApp - YAPC::NA 2014
 
Testing ASP.net Web Applications using Ruby
Testing ASP.net Web Applications using RubyTesting ASP.net Web Applications using Ruby
Testing ASP.net Web Applications using Ruby
 
Building WordPress Client Side Applications with WP and WP-API - #wcmia
Building WordPress Client Side Applications with WP and WP-API - #wcmiaBuilding WordPress Client Side Applications with WP and WP-API - #wcmia
Building WordPress Client Side Applications with WP and WP-API - #wcmia
 
Action View Form Helpers - 1, Season 2
Action View Form Helpers - 1, Season 2Action View Form Helpers - 1, Season 2
Action View Form Helpers - 1, Season 2
 
How to build Client Side Applications with WordPress and WP-API | #wcmia
How to build Client Side Applications with WordPress and WP-API | #wcmiaHow to build Client Side Applications with WordPress and WP-API | #wcmia
How to build Client Side Applications with WordPress and WP-API | #wcmia
 
Rails 2.3 and Rack - NHRuby Feb 2009
Rails 2.3 and Rack - NHRuby Feb 2009Rails 2.3 and Rack - NHRuby Feb 2009
Rails 2.3 and Rack - NHRuby Feb 2009
 
Associations & JavaScript
Associations & JavaScriptAssociations & JavaScript
Associations & JavaScript
 
Using Angular with Rails
Using Angular with RailsUsing Angular with Rails
Using Angular with Rails
 

Similar to How I Roll - A Cucumber/git workflow

Transformando os pepinos do cliente no código de testes da sua aplicação
Transformando os pepinos do cliente no código de testes da sua aplicaçãoTransformando os pepinos do cliente no código de testes da sua aplicação
Transformando os pepinos do cliente no código de testes da sua aplicaçãoRodrigo Urubatan
 
Grand Rapids PHP Meetup: Behavioral Driven Development with Behat
Grand Rapids PHP Meetup: Behavioral Driven Development with BehatGrand Rapids PHP Meetup: Behavioral Driven Development with Behat
Grand Rapids PHP Meetup: Behavioral Driven Development with BehatRyan Weaver
 
Using php to design a guestbook website tutorial
Using php to design a guestbook website tutorialUsing php to design a guestbook website tutorial
Using php to design a guestbook website tutorialphillyquin
 
Custom Post Type - Create and Display
Custom Post Type - Create and DisplayCustom Post Type - Create and Display
Custom Post Type - Create and DisplayJan Wilson
 
Getting Answers to Your Testing Questions
Getting Answers to Your Testing QuestionsGetting Answers to Your Testing Questions
Getting Answers to Your Testing Questionsjasnow
 
Word blogging feature
Word blogging featureWord blogging feature
Word blogging featureAlan Haller
 
Controller Testing: You're Doing It Wrong
Controller Testing: You're Doing It WrongController Testing: You're Doing It Wrong
Controller Testing: You're Doing It Wrongjohnnygroundwork
 
Simple Usability Tweaks for Your WordPress Theme
Simple Usability Tweaks for Your WordPress ThemeSimple Usability Tweaks for Your WordPress Theme
Simple Usability Tweaks for Your WordPress ThemeGraham Armfield
 
Testing web APIs
Testing web APIsTesting web APIs
Testing web APIsFDConf
 
How To Set Up A Blog
How To  Set  Up A  BlogHow To  Set  Up A  Blog
How To Set Up A BlogBobby Norris
 
Integration Test With Cucumber And Webrat
Integration Test With Cucumber And WebratIntegration Test With Cucumber And Webrat
Integration Test With Cucumber And WebratKang-min Liu
 
Behavior Driven Development with Cucumber
Behavior Driven Development with CucumberBehavior Driven Development with Cucumber
Behavior Driven Development with CucumberBrandon Keepers
 
Test-driven Development with Drupal and Codeception (DrupalCamp Brighton)
Test-driven Development with Drupal and Codeception (DrupalCamp Brighton)Test-driven Development with Drupal and Codeception (DrupalCamp Brighton)
Test-driven Development with Drupal and Codeception (DrupalCamp Brighton)Cogapp
 
Content-Driven WordPress Development - WordCamp Omaha 2014
Content-Driven WordPress Development - WordCamp Omaha 2014Content-Driven WordPress Development - WordCamp Omaha 2014
Content-Driven WordPress Development - WordCamp Omaha 2014Stephanie Eckles
 
Getting started-with-oracle-so a-i
Getting started-with-oracle-so a-iGetting started-with-oracle-so a-i
Getting started-with-oracle-so a-iAmit Sharma
 
Getting started-with-oracle-so a-i
Getting started-with-oracle-so a-iGetting started-with-oracle-so a-i
Getting started-with-oracle-so a-iAmit Sharma
 
Passo a Passo para criar uma aplicação Móvel Híbrida
Passo a Passo para criar uma aplicação Móvel HíbridaPasso a Passo para criar uma aplicação Móvel Híbrida
Passo a Passo para criar uma aplicação Móvel HíbridaJuliano Martins
 
Part 1; CSS and placing images on the page: The following files are located i...
Part 1; CSS and placing images on the page: The following files are located i...Part 1; CSS and placing images on the page: The following files are located i...
Part 1; CSS and placing images on the page: The following files are located i...hwbloom15
 

Similar to How I Roll - A Cucumber/git workflow (20)

Transformando os pepinos do cliente no código de testes da sua aplicação
Transformando os pepinos do cliente no código de testes da sua aplicaçãoTransformando os pepinos do cliente no código de testes da sua aplicação
Transformando os pepinos do cliente no código de testes da sua aplicação
 
Cucumber
CucumberCucumber
Cucumber
 
Grand Rapids PHP Meetup: Behavioral Driven Development with Behat
Grand Rapids PHP Meetup: Behavioral Driven Development with BehatGrand Rapids PHP Meetup: Behavioral Driven Development with Behat
Grand Rapids PHP Meetup: Behavioral Driven Development with Behat
 
Using php to design a guestbook website tutorial
Using php to design a guestbook website tutorialUsing php to design a guestbook website tutorial
Using php to design a guestbook website tutorial
 
Custom Post Type - Create and Display
Custom Post Type - Create and DisplayCustom Post Type - Create and Display
Custom Post Type - Create and Display
 
Getting Answers to Your Testing Questions
Getting Answers to Your Testing QuestionsGetting Answers to Your Testing Questions
Getting Answers to Your Testing Questions
 
Word blogging feature
Word blogging featureWord blogging feature
Word blogging feature
 
Controller Testing: You're Doing It Wrong
Controller Testing: You're Doing It WrongController Testing: You're Doing It Wrong
Controller Testing: You're Doing It Wrong
 
Simple Usability Tweaks for Your WordPress Theme
Simple Usability Tweaks for Your WordPress ThemeSimple Usability Tweaks for Your WordPress Theme
Simple Usability Tweaks for Your WordPress Theme
 
Cucumber & BDD
Cucumber & BDDCucumber & BDD
Cucumber & BDD
 
Testing web APIs
Testing web APIsTesting web APIs
Testing web APIs
 
How To Set Up A Blog
How To  Set  Up A  BlogHow To  Set  Up A  Blog
How To Set Up A Blog
 
Integration Test With Cucumber And Webrat
Integration Test With Cucumber And WebratIntegration Test With Cucumber And Webrat
Integration Test With Cucumber And Webrat
 
Behavior Driven Development with Cucumber
Behavior Driven Development with CucumberBehavior Driven Development with Cucumber
Behavior Driven Development with Cucumber
 
Test-driven Development with Drupal and Codeception (DrupalCamp Brighton)
Test-driven Development with Drupal and Codeception (DrupalCamp Brighton)Test-driven Development with Drupal and Codeception (DrupalCamp Brighton)
Test-driven Development with Drupal and Codeception (DrupalCamp Brighton)
 
Content-Driven WordPress Development - WordCamp Omaha 2014
Content-Driven WordPress Development - WordCamp Omaha 2014Content-Driven WordPress Development - WordCamp Omaha 2014
Content-Driven WordPress Development - WordCamp Omaha 2014
 
Getting started-with-oracle-so a-i
Getting started-with-oracle-so a-iGetting started-with-oracle-so a-i
Getting started-with-oracle-so a-i
 
Getting started-with-oracle-so a-i
Getting started-with-oracle-so a-iGetting started-with-oracle-so a-i
Getting started-with-oracle-so a-i
 
Passo a Passo para criar uma aplicação Móvel Híbrida
Passo a Passo para criar uma aplicação Móvel HíbridaPasso a Passo para criar uma aplicação Móvel Híbrida
Passo a Passo para criar uma aplicação Móvel Híbrida
 
Part 1; CSS and placing images on the page: The following files are located i...
Part 1; CSS and placing images on the page: The following files are located i...Part 1; CSS and placing images on the page: The following files are located i...
Part 1; CSS and placing images on the page: The following files are located i...
 

Recently uploaded

Human Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsHuman Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsMark Billinghurst
 
Vertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering TipsVertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering TipsMiki Katsuragi
 
"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii SoldatenkoFwdays
 
Gen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfGen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfAddepto
 
Connect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationConnect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationSlibray Presentation
 
Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Commit University
 
Artificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptxArtificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptxhariprasad279825
 
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)Wonjun Hwang
 
What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024Stephanie Beckett
 
Unraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfUnraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfAlex Barbosa Coqueiro
 
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage CostLeverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage CostZilliz
 
Story boards and shot lists for my a level piece
Story boards and shot lists for my a level pieceStory boards and shot lists for my a level piece
Story boards and shot lists for my a level piececharlottematthew16
 
Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 3652toLead Limited
 
Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!Manik S Magar
 
The Future of Software Development - Devin AI Innovative Approach.pdf
The Future of Software Development - Devin AI Innovative Approach.pdfThe Future of Software Development - Devin AI Innovative Approach.pdf
The Future of Software Development - Devin AI Innovative Approach.pdfSeasiaInfotech2
 
Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Enterprise Knowledge
 
Streamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupStreamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupFlorian Wilhelm
 
Unleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubUnleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubKalema Edgar
 
AI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsAI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsMemoori
 
SAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptxSAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptxNavinnSomaal
 

Recently uploaded (20)

Human Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsHuman Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR Systems
 
Vertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering TipsVertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering Tips
 
"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko
 
Gen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfGen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdf
 
Connect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationConnect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck Presentation
 
Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!
 
Artificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptxArtificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptx
 
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
 
What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024
 
Unraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfUnraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdf
 
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage CostLeverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
 
Story boards and shot lists for my a level piece
Story boards and shot lists for my a level pieceStory boards and shot lists for my a level piece
Story boards and shot lists for my a level piece
 
Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365
 
Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!
 
The Future of Software Development - Devin AI Innovative Approach.pdf
The Future of Software Development - Devin AI Innovative Approach.pdfThe Future of Software Development - Devin AI Innovative Approach.pdf
The Future of Software Development - Devin AI Innovative Approach.pdf
 
Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024
 
Streamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupStreamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project Setup
 
Unleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubUnleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding Club
 
AI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsAI as an Interface for Commercial Buildings
AI as an Interface for Commercial Buildings
 
SAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptxSAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptx
 

How I Roll - A Cucumber/git workflow

  • 1. How I Roll: A Cucumber/git Workflow Matt Buck, Capital Thought
  • 3. Agenda • Creating topic branches in git • Outside-In model of Rails development • Merging topic branches • BONUS ROUND: Getting non-technical stakeholders involved
  • 4. $ issue list 3. Administrators should be able to manage Users 4. Access should be restricted by Role 6. Users should be able to edit account settings 7. Administrators should be able to import Contacts 13. Authors should be able to manage Posts 14. Authors should be able to register
  • 5. $ issue list 3. Administrators should be able to manage Users 4. Access should be restricted by Role 6. Users should be able to edit account settings 7. Administrators should be able to import Contacts 13. Authors should be able to manage Posts 14. Authors should be able to register
  • 6. $ git checkout -b 13_authors_manage_posts
  • 7. Outside-in Rails development • Write a scenario • Execute the scenario • Write a step definition • red/green/refactor View • red/green/refactor Controller • ensure the proper instance variables are assigned • red/green/refactor Models • ensure they provide methods needed by View and Controller
  • 8.
  • 9. Write a step definition
  • 10. red/green/refactor View
  • 11. red/green/refactor Controller
  • 12. red/green/refactor Model
  • 13. Feature: author manages posts As an author I want to be able to manage the posts on my blog So that my audience can read my content Background: Given I am logged in as the following active author account: | Name | Email address | Password | Phone number | Fax number | | John | john@myvenue.com | pass | 555-555-1212 | 555-555-1213 | Scenario: Author adds a new post When I am on the create post page for John When I fill in the form with the following values: | Title | Body | | First post | Hello, blog! | And I press "Add post" Then I should be on the show post page for "First post" And I should see "Your post has been added." And I should see "First post" And I should see "Hello, blog!" And there should be a new post with the title "First post"
  • 14. Outside-in Rails development • Write a scenario • Execute the scenario • Write a step definition • red/green/refactor View • red/green/refactor Controller • ensure the proper instance variables are assigned • red/green/refactor Models • ensure they provide methods needed by View and Controller
  • 15. Feature: author manages posts As an author I want to be able to manage the posts on my blog So that my audience can read my content Background: Given I am logged in as the following active author account: | Name | Email address | Password | Phone number | Fax number | | John | john@myvenue.com | pass | 555-555-1212 | 555-555-1213 | Scenario: Author adds a new post When I am on the create post page for John When I fill in the form with the following values: | Title | Body | | First post | Hello, blog! | And I press "Add post" Then I should be on the show post page for "First post" And I should see "Your post has been added." And I should see "First post" And I should see "Hello, blog!" And there should be a new post with the title "First post"
  • 16. features/env/paths.rb when /the create post page for (.*)$/ author = Author.find_by_name($1) new_author_post_path(author)
  • 17. Feature: author manages posts As an author I want to be able to manage the posts on my blog So that my audience can read my content Background: Given I am logged in as the following active author account: | Name | Email address | Password | Phone number | Fax number | | John | john@myvenue.com | pass | 555-555-1212 | 555-555-1213 | Scenario: Author adds a new post When I am on the create post page for John When I fill in the form with the following values: | Title | Body | | First post | Hello, blog! | And I press "Add post" Then I should be on the show post page for "First post" And I should see "Your post has been added." And I should see "First post" And I should see "Hello, blog!" And there should be a new post with the title "First post"
  • 18. Outside-in Rails development • Write a scenario • Execute the scenario • Write a step definition • red/green/refactor View • red/green/refactor Controller • ensure the proper instance variables are assigned • red/green/refactor Models • ensure they provide methods needed by View and Controller
  • 19. spec/views/posts/new.html.haml_spec.rb describe "/posts/new.html.haml" do before(:each) do assigns[:post] = Factory.build :post @author = Factory.create :author assigns[:author] = @author end it "should render new form" do render "/events/new.html.haml" response.should have_tag("form[action=?][method=post]", author_posts_path(@author)) end end app/views/posts/new.html.haml %h1 New post - form_for([@author, @post]) do |f| = render :partial => "form", :locals => {:f => f} %p= f.submit "Add Post"
  • 20. Feature: author manages posts As an author I want to be able to manage the posts on my blog So that my audience can read my content Background: Given I am logged in as the following active author account: | Name | Email address | Password | Phone number | Fax number | | John | john@myvenue.com | pass | 555-555-1212 | 555-555-1213 | Scenario: Author adds a new post When I am on the create post page for John When I fill in the form with the following values: | Title | Body | | First post | Hello, blog! | And I press "Add post" Then I should be on the show post page for "First post" And I should see "Your post has been added." And I should see "First post" And I should see "Hello, blog!" And there should be a new post with the title "First post"
  • 21. Outside-in Rails development • Write a scenario • Execute the scenario • Write a step definition • red/green/refactor View • red/green/refactor Controller • ensure the proper instance variables are assigned • red/green/refactor Models • ensure they provide methods needed by View and Controller
  • 22. spec/controllers/posts_controller_spec.rb describe "responding to GET new" do def do_get(params = {}) stub_author get :new, {:author_id => @author} end it "should expose a new post as @post" do post = Factory.build(:post) Post.should_receive(:new).and_return(post) do_get assigns[:post].should equal(post) end end app/controllers/posts_controller.rb def new @post = Post.new(params[:post]) respond_to do |format| format.html # new.html.erb format.xml { render :xml => @post } end end
  • 23. Feature: author manages posts As an author I want to be able to manage the posts on my blog So that my audience can read my content Background: Given I am logged in as the following active author account: | Name | Email address | Password | Phone number | Fax number | | John | john@myvenue.com | pass | 555-555-1212 | 555-555-1213 | Scenario: Author adds a new post When I am on the create post page for John When I fill in the form with the following values: | Title | Body | | First post | Hello, blog! | And I press "Add post" Then I should be on the show post page for "First post" And I should see "Your post has been added." And I should see "First post" And I should see "Hello, blog!" And there should be a new post with the title "First post"
  • 24. features/env/paths.rb when /the (create|show) post page for (.*)$/ author = Author.find_by_name($2)‚Ä® case $1 when /create/ new_author_post_path(author) when /show/ autho_post_path(author)
  • 25. Feature: author manages posts As an author I want to be able to manage the posts on my blog So that my audience can read my content Background: Given I am logged in as the following active author account: | Name | Email address | Password | Phone number | Fax number | | John | john@myvenue.com | pass | 555-555-1212 | 555-555-1213 | Scenario: Author adds a new post When I am on the create post page for John When I fill in the form with the following values: | Title | Body | | First post | Hello, blog! | And I press "Add post" Then I should be on the show post page for "First post" And I should see "Your post has been added." And I should see "First post" And I should see "Hello, blog!" And there should be a new post with the title "First post"
  • 26. spec/controllers/posts_controller_spec.rb it "should redirect to the created post" do Post.stub!(:new).and_return(@new_post) post :create, :post => {} response.should redirect_to(author_post_url(@author, @new_post)) end app/controllers/posts_controller.rb # POST /posts # POST /posts.xml def create @post = @author.posts.new(params[:post]) respond_to do |format| if @post.save flash[:notice] = 'Post was successfully created.' redirect_to author_post_url(@author, @post) else render :action => "new" end end end
  • 27. Feature: author manages posts As an author I want to be able to manage the posts on my blog So that my audience can read my content Background: Given I am logged in as the following active author account: | Name | Email address | Password | Phone number | Fax number | | John | john@myvenue.com | pass | 555-555-1212 | 555-555-1213 | Scenario: Author adds a new post When I am on the post creation page for John When I fill in the form with the following values: | Title | Body | | First post! | Hello, blog! | And I press "Add post" Then I should be on the show post page for "First post" And I should see "Your post has been added." And I should see "First post" And I should see "Hello, blog!" And there should be a new post with the title "First post"
  • 29. Feature: author manages posts As an author I want to be able to manage the posts on my blog So that my audience can read my content Background: Given I am logged in as the following active author account: | Name | Email address | Password | Phone number | Fax number | | John | john@myvenue.com | pass | 555-555-1212 | 555-555-1213 | Scenario: Author adds a new post When I am on the post creation page for John When I fill in the form with the following values: | Title | Body | | First post | Hello, blog! | And I press "Add post" Then I should be on the show post page for “First Post” And I should see "Your post has been added." And I should see "First post" And I should see "Hello, blog!" And there should be a new post with the title "First post"
  • 30. Feature: author manages posts As an author I want to be able to manage the posts on my blog So that my audience can read my content Background: Given I am logged in as the following active author account: | Name | Email address | Password | Phone number | Fax number | | John | john@myvenue.com | pass | 555-555-1212 | 555-555-1213 | Scenario: Author adds a new post When I am on the post creation page for John When I fill in the form with the following values: | Title | Body | | First post | Hello, blog! | And I press "Add post" Then I should be on the show post page for “First Post” And I should see "Your post has been added." And I should see "First post" And I should see "Hello, blog!" And I should see "This post contains 22 characters" And there should be a new post with the title "First post"
  • 31. spec/views/posts/show.html.haml_spec.rb describe "/posts/show.html.haml" do before(:each) do @post = Factory.create :post @author = Factory.create :author assigns[:author] = @author assigns[:post] = @post @post.stub!(:total_length).and_return(24) end it "should display the length of the post in characters" do render "/events/show.html.haml" response.should have_tag("span#length", :text => 24) end end app/views/posts/new.html.haml %h1= @post.title %span#length= @post.total_length
  • 32. spec/models/post_spec.rb it "should return the length of the body and title in characters" do post = Post.create :title => "Title", :body => "Body" post.total_length.should == 9 end spec/models/post.rb def total_length title.size + body.size end
  • 33. Feature: author manages posts As an author I want to be able to manage the posts on my blog So that my audience can read my content Background: Given I am logged in as the following active author account: | Name | Email address | Password | Phone number | Fax number | | John | john@myvenue.com | pass | 555-555-1212 | 555-555-1213 | Scenario: Author adds a new post When I am on the post creation page for John When I fill in the form with the following values: | Title | Body | | First post | Hello, blog! | And I press "Add post" Then I should be on the show post page for “First Post” And I should see "Your post has been added." And I should see "First post" And I should see "Hello, blog!" And I should see "This post contains 22 characters" And there should be a new post with the title "First post"
  • 34. $ git checkout master $ git merge --squash 13_authors_manage_posts $ git commit -m “Implemented <...> Closes #13”
  • 35.
  • 36. $ git checkout master $ git merge --squash 13_authors_manage_posts $ git commit -m “Implemented <...> Closes #13”
  • 37. $ git checkout master $ git merge 13_authors_manage_posts
  • 38.
  • 40. How do we get non-technical stakeholders involved in the story creation process?
  • 41.
  • 42.
  • 43. Credits, etc. • Cucumber roll image: http://www.flickr.com/ photos/stuart_spivack/464718611/ • Github Issues CLI: http://github.com/jsmits/ github-cli/tree/master • The RSpec Book: http://www.pragprog.com/ titles/achbd/the-rspec-book