Don't show "use gdk rake" warning when running bundle exec rspec

What does this merge request do and why?

This MR suppresses the "use gdk rake" warning when running bundle exec rspec to avoid spamming the console during test runs. The warning now only shows up when actually running rake commands.

This is a regression from !4872 (merged).

How to set up and validate locally

  1. Check that no warning is shown: cd gitlab && bundle exec rspec spec/features/user_settings/ssh_keys_spec.rb
  2. Check that the warning still shows up as expected: cd .. && bundle exec rake setup_ai_gateway

Impacted categories

The following categories relate to this merge request:

Merge request checklist

  • This MR references an issue describing the change.
  • This change is backward compatible. If not, please include steps to communicate to our users.
  • Tests added for new functionality. If not, please raise an issue to follow-up.
  • Documentation added/updated, if needed.
  • Announcement added, if change is notable.
  • gdk doctor test added, if needed.

Merge request reports

Loading