Tutorial Details
- Technologies: Ruby, Sinatra, rspec
- Difficulty: Moderate
- Format: 11 Minute Screencast
In today’s video tutorial, I’m going to teach you how to use rspec within a Sinatra application. Along the way, we’ll also arrange for autotesting with Growl notifications so that our tests run automatically when we save our projects. If you’re quite new to the idea of testing, this is the perfect introduction.
We’ll Cover…
- Installing rspec
- Integrating rspec into a Sinatra application
- The basic syntax for rspec tests
- Enabling Growl notifications
- Autotesting

Hey guys. I can’t remember if I covered this in the video, but if not: after you move your _spec file to the spec/ folder, make sure you update the “require” at the top of the page. You can do require_relative ‘../reverse.rb’
Great screencast! I didn’t realise testing was this easy in sinatra, so I haven’t bothered to do it properly before. Looks like that’ll change :P
Great screencast as always. btw you can reverse the string just by calling it directly string.reverse
Thanks! Yeah, I know about the reverse method; I had planned on doing something fun with those join/split methods to help out with the testing aspect, but it ended up being cut out of the screencast. :/
real nice tut!
Great screencast Jeffrey. I like how you’re really to the point. :-)
Still can’t get into a habit testing my ruby code :( Thanks anyway
For those who do not have the newest ruby. You gotta add the following instead:
require File.join(File.dirname(__FILE__), ‘../reverse.rb’)
require ‘rubygems’
Just fyi :)