Stabilize GithubService spec by loosening settings.write expectations

What does this MR do and why?

This MR refactors the RSpec tests for the EE::Import::GithubService to eliminate flakiness around the settings.write calls. The strict stub on settings.write plus exact‐match have_received(...).with(...) expectations were causing intermittent failures whenever the service passed additional keys (e.g. extra access tokens) or reordered the hash.

This change:

  • Replaces the .to receive(:write).with(...) stub with a catch-all allow(settings).to receive(:write), so every call is intercepted.
  • Updates each expect(settings).to have_received(:write).with(...) to use hash_including(...) instead of exact equality. This ensures we only assert on the three keys we care about, without breaking if extra keys are present.

By making these adjustments, the spec will no longer be brittle about the exact hash contents and will eliminate the flaky failures related to settings.write.

References

#540946 (closed), #540945 (closed), #540944 (closed)

Screenshots or screen recordings

N/A

How to set up and validate locally

  1. Check out this branch.
  2. Run the spec file multiple times:
    bundle exec rspec ee/spec/services/ee/import/github_service_spec.rb
  3. The tests related to optional_stages, timeout_strategy, and pagination_limit should now pass consistently.

MR acceptance checklist

Evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.

Edited by 🤖 GitLab Bot 🤖

Merge request reports

Loading