This occurs in the chapter "The Secret Riddle" where Ginny is struggling with her feelings for Harry and the fact that he is dating Luna Lovegood. Hermione, knowing the truth about Harry's feelings for Ginny, encourages her to talk to him and be honest about her feelings.