Create a Ruby on Rails TODO application

In an attempt to improve my RoR skills and based on the suggestion of @m3talsmith, I am going to be creating a TODO application from almost scratch.  I will be blogging each step as I create the TODO both for my personal learning experience in addition to helping others to learn.

The TODO application will initially involve the following functions:

  • Add a note
  • Edit a note
  • Delete a note
  • View all notes

These functions will initially be for html, then xml and then json.

Creating Stories

I have found that creating stories for each function is a great way to think thru the workflow.  I personally use Pivotal Tracker but there are other applications out there that you can use.

ISBAT - I should be able to

Generally, the stories are created using ISBAT.  For this TODO application, I will start with four stories:

  • As a visitor ISBAT create a note
  • As a visitor ISBAT edit a note
  • As a visitor ISBAT delete a note
  • As a visitor ISBAT view all notes

For testing I will be using Rspec and Capybara.  There are a lot of things that can be tested in an application, but I am going to be using just request specs.  These are tests to emulate the actual user experience to include filling in fields and clicking on buttons and links.  The theory behind this is that if you test all of the possible actions a user can perform, then the functionality behind the actions should work correctly.  I will be creating a blog entry for each of the above listed stories.

Project Setup

The guys at RebelHold have created a great open source starter application to build an application upon which uses MongoDB and Mongoid, Haml, Rspec, FactoryGirl, and Heroku.  As a today, Rebel-Foundation uses Rails 3.1.3 and Ruby 1.9.2.

To create my project I will clone Rebel-Foundation from github:

[sourcecode language="bash"]
git clone git@github.com:rebelhold/Rebel-Foundation.git todo_app
[/sourcecode]

This creates a new Rails application named "todo_app". Following the instructions on github:

== Instructions

For those rvm users we've included a rvmrc. Just:

cp rvmrc .rvmrc
cd ..

And cd back in to your project.

Accept the rvmrcgem install bundler
bundle

If you are NOT using rvm, then you need to!!

This will setup the basic project.  My next blog entry will be writing the first story, the tests for that story and the code to pass the tests.

comments powered by Disqus