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

Applications First, Frameworks Second

Applications First, Frameworks Second

This is the short presentation before the start of my workshop at Railsconf 2014. The deck is short. It's just an introduction to the code found on github. https://github.com/ahawkins/applications-first-frameworks-second see https://github.com/ahawkins/applications-first-frameworks-second/pulls?direction=asc&page=1&sort=created&state=closed to work though the steps.

Adam Hawkins

April 24, 2014
Tweet

More Decks by Adam Hawkins

Other Decks in Programming

Transcript

  1. Go

  2. Step 1: pulls/1 • Make “bundle exec rake” run tests

    • Create a failing test to ensure things work correctly • git checkout feature/step-1 ; git checkout HEAD~2
  3. Step 2: pulls/2 • git checkout -b feature/step-1; git checkout

    -b my-step-2 • Create a failing acceptance/integration/system test • This test should create a “Post” with a “title” & “text” attributes • Test that this object is persisted some how • PublishPost — Service Object — instantiated with the form • PublishPostForm — models input — instantiated with a Hash • PostRepo — manages the Posts
  4. Step 3: pulls/3 • git checkout -b feature/step-2 • Write

    a unit test for the “Post” class • Test it can be initialized with a Hash • ruby test/post_test.rb
  5. Step 4: pulls/4 • git checkout -b feature/step-3 • Define

    “PublishPostForm” • Hint: use Chassis.form (see chassis readme) • Hint: nothing to test yet
  6. Step 5: pulls/5 • git checkout feature/step-4 • Create “PostRepo”

    • Use Chassis::Repo::Delegation • Refer to chassis README for an example • No tests needed for this one
  7. Step 6: pulls/6 • Introduce a stub “PublishPost” service object

    • It should implement the interface in the acceptance tests • Don’t add functionality
  8. Step 8: pulls/8 • Add another test case to the

    acceptance test that does not include a “text”/“title” • Make it pass! • Hint: add validation to the form • Chassis.repo.clear
  9. Step 10: pulls/10 • Time to think in HTML •

    Use capybara to create failing tests and submits a form and then displays the post