How I Roll - A Cucumber/git workflow

Loading...

Flash Player 9 (or above) is needed to view presentations.
We have detected that you do not have it on your computer. To install it, go here.

0 comments

Post a comment

    Post a comment
    Embed Video
    Edit your comment Cancel

    3 Favorites

    How I Roll - A Cucumber/git workflow - Presentation Transcript

    1. How I Roll: A Cucumber/git Workflow Matt Buck, Capital Thought
    2. We make Capital Thought I work for
    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. • Write a step definition
    9. • red/green/refactor View
    10. • red/green/refactor Controller
    11. • red/green/refactor Model
    12. 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"
    13. 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
    14. 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"
    15. features/env/paths.rb when /the create post page for (.*)$/ author = Author.find_by_name($1) new_author_post_path(author)
    16. 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"
    17. 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
    18. 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"
    19. 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"
    20. 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
    21. 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
    22. 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"
    23. 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)
    24. 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"
    25. 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
    26. 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"
    27. Fast forward...
    28. 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 I should see "This post contains 22 characters" And there should be a new post with the title "First post"
    30. 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
    31. 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
    32. 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"
    33. $ git checkout master $ git merge --squash 13_authors_manage_posts $ git commit -m “Implemented <...> Closes #13”
    34. $ git checkout master $ git merge --squash 13_authors_manage_posts $ git commit -m “Implemented <...> Closes #13”
    35. $ git checkout master $ git merge 13_authors_manage_posts
    36. Bonus Round
    37. How do we get non-technical stakeholders involved in the story creation process?
    38. 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

    + techpeacetechpeace, 4 months ago

    custom

    1030 views, 3 favs, 2 embeds more stats

    Outlines a simple Rails workflow utilizing git, Git more

    More info about this document

    © All Rights Reserved

    Go to text version

    • Total Views 1030
      • 1019 on SlideShare
      • 11 from embeds
    • Comments 0
    • Favorites 3
    • Downloads 19
    Most viewed embeds
    • 10 views on http://www.thatwebmuck.com
    • 1 views on http://0.0.0.0:4000

    more

    All embeds
    • 10 views on http://www.thatwebmuck.com
    • 1 views on http://0.0.0.0:4000

    less

    Flagged as inappropriate Flag as inappropriate
    Flag as inappropriate

    Select your reason for flagging this presentation as inappropriate. If needed, use the feedback form to let us know more details.

    Cancel
    File a copyright complaint
    Having problems? Go to our helpdesk?

    Categories