I think we can use    ```ruby  stderr = capture(:stderr) do    # rake ...  end    assert_match(/DEPRECATION WARNING: .../, stderr)  ```  I had similar case in https://github.com/rails/rails/commit/a6ebafc5ac71dd11a548ac884dc1637a1a5db926