Ruby (on Rails)
I've been using Ruby on Rails for a few years, in my spare time, and hope to keep working with it whenever the opportunity arises. A couple of college friends and I created hospitalpages.ie which is was developed using Ruby on Rails, Git and Capistrano for deployment. I also hope to dabble more in pure Ruby scripting, to date I've used it for automating data insertion with MySQL and some file parsing.
BDD - Rails 3, AutoTest, RSpec and Growl
RSpec and AutoTest with Growl notifications set up for Ubuntu 10.10. Here's what worked for me. This is a rapid post to help me when I need to do this in the future. There is a more comprehensive guide for more platforms here http://ph7spot.com/musings/getting-started-with-autotest
lines that start with t: are to be run in terminal
t: sudo gem install rspect: sudo gem install rspec-rails
t: sudo gem install autotest
t: sudo gem install autotest-rails
t: sudo gem install autotest-growl
t: sudo gem install autotest-notification
t: sudo gem install test_notifier
t: sudo apt-get install libnotify-bin
t: find ~/ -iname '.autotest'
t: sudo gedit
Add following lines .autotest file:
require "autotest/growl"
require "test_notifier/autotest"
t: an-install
t: rails new some-app-name>
t: rails scaffold some-name model-details
t: rake db:migrate (create the database before running this)
In application.rb of the rails app add the following lines:
1 config.generators do |g|</p> 2 g.test_framework :rspec</p> 3 end
Add the following to Gemfile of rails application
gem 'rspec'
gem 'rspec-rails'
t: rails generate rspec:install
t: rake -T spec
rake -t spec should show you the rspec rake tasks that are now available.
t: rake spec (this creates the test database entries required for you tests)
Start autotest under your rails application by typing autotest
If things have worked you should get a window pop up with a green smiley face, assuming you have some tests that pass, otherwise you'll see a red sad face.
blog comments powered by Disqus





