O'Reilly logo

Instant RSpec Test-Driven Development How-to by Charles Feduke

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Preparing the RSpec environment (Simple)

In this section, we'll setup a new project that will be used with RSpec and lay some of the foundation source code for the later sections in this book.

How to do it...

  1. First, create a lib subdirectory under spec and create the location_spec.rb file:
    $ mkdir spec/lib
    $ touch spec/lib/location_spec.rb
    
  2. We'll begin this process by authoring a specification in spec/lib/location_spec.rb:
    require "spec_helper"
    describe Location do
    end
  3. Save the file and run it from your terminal:
    $ rspec spec
    
  4. You'll see a stack trace alerting that there is an uninitialized constant named Location:
    How to do it...

    Note

    This is to verify that it fails for ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required