Posts Tagged "rspec"

[Ruby] How to use RSpec – 01 QuickStart

»Posted by on Mar 13, 2009 in Blog | 0 comments

RSpec is one of ruby’s testing frameworks for BDD(Behavior Driven Development). Install RSpec % sudo gem install rspec Quickstart Directory Structure for sample program below. put libraries into lib/ directory. put spec(test) programs into spec/directory. sample_project/ lib/sample.rb sample library to test spec/ sample_spec.rb test program for sample.rb spec_helper.rb common settings and functions for all tests. Create directories Create a project directory, create lib and spec directory in the project directory. % mkdir sample_project % cd sample_project % mkdir lib % mkdir spec Create spec_helper.rb sample_project/spec/spec_helper.rb : # encoding: utf-8 require "rubygems" require 'test/unit' require "spec" $LOAD_PATH <<...

read more