adding rspec and tests for existing functionality