moved common methods to spec helper