rspec tests. made a few tweaks to api