Tuesday, 14 October 2008

BDD with Ruby applications using Netbeans IDE

Being from a .net background, I am used to working with IDEs. I tried for a bit without, but didn't get into it, it's alright for the Textmate users but I am on a Windows system at the moment. Building apps using Notepad or SciTE gets a bit laborious, so I downloaded Netbeans.

Rails appswith Netbeans are quite straight forward, but I've spent ages trying to get Cucumber working from Netbeans and have just solved the problem.

Anyway, this is how to get things working from inside the Netbeans IDE:

Cucumber

First of all install the gem
gem install cucumber
Add this to the Rakefile in the project root
require 'rubygems'
require 'cucumber/rake/task'

Cucumber::Rake::Task.new

Now the project context menu will have "features" in the "Run rake task" menu item.

RSpec

require 'spec/rake/spectask'
Spec::Rake::SpecTask.new
Then create spec_helper.rb with
$:.unshift(File.dirname(__FILE__) + '/../lib/')
and require
require File.expand_path(File.dirname(__FILE__) + '/spec_helper')
in each of your spec files

Autotest

Still haven't got Autotest to work, but will updated this post when I finally do.

1 comment: