How to Integrate rspec into a Sinatra App
videos

How to Integrate rspec into a Sinatra App

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.

Choose 720p for optimal viewing.
Subscribe to our YouTube and Blip.tv channels to watch more screencasts.

We’ll Cover…

  • Installing rspec
  • Integrating rspec into a Sinatra application
  • The basic syntax for rspec tests
  • Enabling Growl notifications
  • Autotesting

Note: Want to add some source code? Type <pre><code> before it and </code></pre> after it. Find out more
  • http://www.jeffrey-way.com Jeffrey Way
    Author

    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’

  • http://tombrunoli.com/ Tom

    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

  • G

    Great screencast as always. btw you can reverse the string just by calling it directly string.reverse

    • http://www.jeffrey-way.com Jeffrey Way
      Author

      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. :/

  • salomoko

    real nice tut!

  • http://www.denk-groot.nl Bram Jetten

    Great screencast Jeffrey. I like how you’re really to the point. :-)

  • http://tipugin.ru Alexander Tipugin

    Still can’t get into a habit testing my ruby code :( Thanks anyway

  • http://namis.me geeknam

    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 :)

  • john davison

    having trouble getting growl notifications, otherwise, this is a great screencast