refactoring code climate
added rspec tests