Refactor spec_helpers.rb