rspec tests (a start at least)

random bug fixes and a Gemfile too