Saturday 17 March 2012

Ruby on Rails

Like many others, I have signed up for the Software as a Service online course hosted on corsera.com, it is my first real look at Behaviour Driven Design and Test Driven Design.

I find it interesting that the IDACS development team I worked with at the turn of the century followed many of the Agile principles, although we didn't have the formal sprints and reviews. We did, however, meet up at least once a month to review our work (and the occasional pint or two was imbibed).

My current project is with coming to grips with the whole SaaS principles.
The first week was learning some basic Ruby (a language I am rapidly coming to love), followed by a trip into Ruby on Rails and this last week with using Cucumber to have test scripts that pass or fail the code that has been written.

I have been having an interesting time trying to get Cucumber to work nicely on my OSX machine (thankfully the SaaS course provided a vm with everything set up ready to rock). Everything in the Ruby world seems to be evolving at a rapid pace, and many of the online instructional videos are a little out of date.

To get Cucumber to run on my machine, I found (after much perusing and changing keywords in searches) that the following seems to work:

In the Gemfile, add the following code:
group :test do
  gem 'rspec', '>=2.5.0'
  gem 'capybara'
  gem 'cucumber','>=1.1.4'
  gem 'cucumber-rails','>=1.3.0'
  gem 'database_cleaner'
  gem 'webrat'
end

Adding
gem 'haml-rails'
will also give you the haml templates instead of erb (wish I found that before I set up my current test project).

Run bundle update at the command line, followed by:

rails generate cucumber:install --capybara

This creates the features folder with the appropriate helper addons.
I did spend some time trying to work out where the web_steps.rb file had gone, but it is no longer included as part of the package. Apparently due to people creating steps files that are over detailled and prone to being brittle and breaking with relatively minor changes to the codebase.

Now all I need to do is to start building apps using the tools. One is going to be a blog type facility based on the Railscasts videos, and the other is to make a waiting list management site.