rubyaustralia / melbourne-ruby

Organisers notes and processes
54 stars 5 forks source link

writing that first rails test #187

Closed saramic closed 2 years ago

saramic commented 3 years ago

so you have done a boot camp or have created a rails project that you want to take it to the next level. Everyone is telling you that testing is a good thing but how and where do you get started?

in this intro to testing, I will take you through the following steps

  1. add rspec/capybara for testing
  2. write an "End to End" (E2E) "user flow" through your app, retrospectively
  3. split the flow into a series of "arrange" (When) and "assert" (Then) statements
  4. make it run in the browser
  5. abstract the page with a Page Object Model using site_prism gem
  6. delete all that cruft that you may have scaffolded up in the first place
  7. touch on how to incrementally build out your app driving it with tests using "pending" statements
saramic commented 3 years ago

follow along at https://github.com/saramic/rails-shorts-demo