UPDATE: I’m very eager to see where IronRuby and RSpec go for the .NET world. Testing my C# Applications with RSpec would be awesome. Check out the MSDN magazine article about this stuff if you haven’t already.
I’m working with a Ruby on Rails project now (RoR from now on) and
absolutely loving it. I’m on nothing but Linux boxes, working with
Ruby, and have been put in charge of strengthening our testing skills.
I kind of laugh at this because I am having to learn Ruby, Rails,
Nginx, Mongrels, etc and then figure out how to test RoR code.
I still touch up a C# API for another project at the company I work for; I’m not completely disconnected from the .NET world.
I
went down the Test::Unit path first, due to the fact that it comes with
Rails. I was quickly reminded why I went down the Behavior Driven
Development path in C#. Test::Unit is a lot of doing Test Driven
Development in NUnit (or other xUnit) fashion. You prefix your tests
with “test_” and go from there. It works. I can’t deny that in either
the .NET world or the Rails world. I just prefer to focus on the
behavior because it highlights that I will only make specifications or
examples pass because they are serving a function my user has requested.
I
then went down the, ever popular, RSpec path. A few more gems installed
and another TextMate bundle to gain some RSpec macros. I liked it but
it felt like too much. I can’t explain it. I have friends who swear by
RSpec and more power to them. Going down this route also exposed
Zentest/autotest to me. For testing specs I’d use autospec from the
same tool. Once I figured out how to sync Growl (I’m on a Macbook Pro),
the notification tool on a Mac, with autospec, I was in heaven. So I’d
run autospec, it would run all my specs and then spit up a notification
with a green window for passing specs or red for failure with the count
of failed tests. Autospec would then just wait for a file to change and
then run the specs in the file and again notify me. It was like my own
local CI notification.
I then found out about Shoulda. Shoulda
is a gem/plugin that gives you the same context/should notation as
RSpec but still utilizing the Test::Unit portion of Rails (again
Test::Unit comes with Rails by default). I had some fun getting it
working but with some help on the Google Group
(http://groups.google.com/group/shoula), I was able to get it working
pretty fast. And instead of running autospec, I’d run autotest again
with a few changes to my ~/.autotest file to get my local notifications.
I
will be posting more posts going into detail about all of these
paragraphs and also about my continuing adventures in the Ruby on Rails
and Linux world.
Things I will be posting about:
- Nginx
- Apache with Phusion Passenger
- Linux OS (commands, basic setup, security, etc)
- Ruby on Rails
- Ruby
- Python
- Django
- TextMate (code editor on Mac)
- CloudFiles (Rackspace Cloud storage)
- Hudson and CruiseControl.rb (Continuous Integration software that works with Ruby)
