title: Rspec 3 how to test flash messages
body: <p>I want to test controller's action and flash messages presence with rspec.</p>
  
  <p><strong>action</strong>:</p>
  
  <pre><code>def create
    user = Users::User.find_by_email(params[:email])
    if user
      user.send_reset_password_instructions
      flash[:success] = "Reset password instructions have been sent to #{user.email}."
    else
      flash[:alert] = "Can't find user with this email: #{params[:email]}"
    end
  
    redirect_to root_path
  end
  </code></pre>
  
  <p><strong>spec</strong>:</p>
  
  <pre><code>describe "#create" do
    it "sends reset password instructions if user exists" do
      post :create, email: "email@example.com"      
      expect(response).to redirect_to(root_path)
      expect(flash[:success]).to be_present
    end
  ...
  </code></pre>
  
  <p>But I've got an error:</p>
  
  <pre><code>Failure/Error: expect(flash[:success]).to be_present
     expected `nil.present?` to return true, got false
  </code></pre>