Decouple test from implementation and move methods into rspec utilities