6.18. Ruby Notes

6.18.1. Ruby Language Documentation

Squish assumes that all test.rb files use the UTF-8 encoding. Every .rb you use should begin with the line:

# encoding: UTF-8

Squish tests written in Ruby should always begin:

# encoding: UTF-8
require 'squish'
include Squish

A Ruby-savvy editor will notice the first line and will correctly load and save using the UTF-8 encoding that Squish expects, as a result.

Furthermore, the Ruby versions of the functions documented in Object Access Functions (Section 6.3.3) need to be fully-qualified with Squish:: to avoid clashes with the default Ruby Object type. For instance, you have to use

list = Squish::Object.children(o);

instead of

list = Object.children(o);

The latter will cause an error when replaying the test script since the Ruby interpreter will attempt to access the (non-existant) children method on the built-in Object type.

6.18.1. Ruby Language Documentation

The official Ruby website has many documentation links on the http://www.ruby-lang.org/en/documentation/ page. There is also an online book: Programming Ruby: The Pragmatic Programmer's Guide.

If you prefer books, a good Ruby book is The Ruby Programming Language by David Flanagan and Yukihiro Matsumoto (Ruby's creator).