Making of Varcasa.com

Friday, June 30, 2006

Ruby is more Object Oriented then Java !!!

This simple example proves that Ruby is more object oriented than java.

To find absolute of a number,

in Java we need to use a seperate class - Math.abs(-24)

but,

in Ruby abs functionality is built in the number - -24.abs

Thursday, June 29, 2006

Domain Specific Language in Integration Testing

I found something cool about Integration tests in Rails. We could built a mini language ( DSL) for your Integration tests.

For example in Varcasa, I could write Integration tests like this

def test_user_should_be_able_login_after_registration_story
user = regular_user
user.goto_registration_page
user.register("user","password","email)
user.goto_login_page
user.login("user","password")
end

It is so much fun. I am amazed how ruby makes it so easy to define a DSL.

More Info:

Wednesday, June 28, 2006

Integration Testing

Rails 1.1 has a new set of tests called "Integration Test". There are so many different definitions for Integration Testing. I asked some developers and QAs, what is Integration test means and everyone gave me a different definition.

But in rails world,
"An Integration Test is one that spans multiple controllers and actions, tying them all together to ensure they work together as expected. It tests more completely than either unit or functional tests do, exercising the entire stack, from the dispatcher to the database."

In Varcasa, I am having Integration test for each story . Instead of duplicating, I am putting the acceptance criteria in my Integration tests. It is working out good for me. Now I can find out what stories are getting affected when I implement a new story.

More Info:

Monday, June 26, 2006

Migrations

Tracking database changes have always been a pain. Thanks to Migrations in rails now changes to database schema is just like any other code.

I am using Migrations in Varcasa, you wont believe how easy it is.

More info,

Capistrano (formally SwitchTower)

For my production deployment, I am using Capistrano.

It was a pain to set it up initially. But once I got it working, it was so pleasant to work with.

If you are planning to deploy a rails application, you should definitely checkout Capistrano.

More info:

Freeze !!!

Dreamhost was initially having rails 1.0. Varcasa was running happily. Suddenly one day, Varcasa was broken. It was wierd, it was working in my laptop. I was not able to recreate the problem in my laptop. Then I found out that dreamhost have updated their rails to 1.1 version. So I updated rails in my laptop and was able to create the problem. Then went thru all the steps of upgrading to Rails 1.1.

I realised that this is going to be a chronic problem. I was pissed off that I have to know follow what version of Rails Dreamhost is running. I know that rails community cant be that stupid, so I started searching in web. Then I found out about freeze rails functionality.

It is so easy.

rake freeze_rails command will copy the current rails version in your machine to vendor/rails folder. When application starts it will first look at vendor/rails folder to load rails. So using freeze_rails we do not have to worry whether the host company will update rails version and break our application.

UPDATED: rake freeze_rails won't work from Rails 1.1.2. Use rake rails:freeze:gems instead

More info,

Setting up Rad Rails

  1. Download and install Eclipse.
  2. Opening Eclipse, go to the Help menu, and under Software Updates, choose Find and Install.
  3. Press the Next button
  4. Click the New Remote Site button
  5. Add http://updatesite.rubypeople.org/release as "RDT"
  6. Add http://radrails.sourceforge.net/update as "Radrails"
  7. Hit next, and then select and install RDT and Radrails.
  8. You should be good to go after restarting Eclipse.

Environments used

What is Varcasa?

Varcasa (www.varcasa.com) is a educational portal that will help students of all ages and levels a place to collabrate and learn from each other.

"Collabration is Knowledge"

In this blog , I am planning to share my date to date activities in creating Varcasa. I hope this will be a useful for others to learn from my experience.