Upgrade RSpec to latest version, fix deprecations, warnings

Upgrade the internal test suite to the latest version of RSpec, removing all deprecation warnings.
Fixing all ruby warnings generated by test suite.
Fix up a few bugs revealed by changes. 
Fixes #238