Refactor test specs by relevant function