Encapsulate methods in class and rspec test passed