Getting started

edit

This assumes that the system being worked on is Linux or Unix-based with the Ruby programming language already installed. For Windows, a virtual machine environment such as the Oracle VM VirtualBox can be used to run a version of Linux. On a Unix-like Operating System, the system's package manager is the easiest way to get started with Ruby. A better alternative to using the system Ruby is to install Ruby with the Ruby Version Manager (RVM). RVM is a tool for installing different versions of Ruby and has several advantages.

Installation steps

edit
  1. Install Rspec by running the following command:
    $gem install rspec 
    >Done installing documentation for rspec-support, rspec-core, diff-lcs, rspec-expectations, rspec-mocks, rspec after 8 seconds 
    6 gems installed
    This command gives a permission error if an attempt is made to make changes to the system Ruby.
  2. Prepare the directory structure using the following command:
    $mkdir lib
  3. Run Rspec
    rspec --init
  4. Rspecs can now be run on the empty specs directory.
    $rspec spec >No examples found. 
    Finished in 0.00045 seconds (files took 0.11565 seconds to load) 0 examples, 0 failures
    This verifies that the gem has been installed.

Other Ruby testing tools

edit