Skip to content

Add dedicated spec file for Geo::VerificationStateDefinition concern to test new scopes

Everyone can contribute. Help move this issue forward while earning points, leveling up and collecting rewards.

Problem

The Geo::VerificationStateDefinition concern was enhanced in MR !206339 (merged) with new scopes (after_cursor, keyset_order, verification_state_not_pending), but there is no dedicated spec file to test these scopes directly.

Currently, these scopes are only tested indirectly through the services and workers that use them, which makes it harder to ensure comprehensive coverage and catch edge cases.

Proposed Solution

Create a dedicated spec file ee/spec/models/concerns/geo/verification_state_definition_spec.rb to test the scopes added to the Geo::VerificationStateDefinition concern.

Scope Coverage Needed

The following scopes should be tested:

  1. after_cursor - Tests cursor-based pagination functionality

    • Should return all records when cursor is nil
    • Should return records after the specified cursor value
    • Should handle composite primary keys correctly
    • Should be chainable with other scopes
  2. keyset_order - Tests keyset ordering functionality

    • Should apply the correct ordering based on provided attributes
    • Should work with composite primary keys
    • Should be chainable with other scopes
  3. verification_state_not_pending - Tests verification state filtering

    • Should exclude records with pending verification state (value 0)
    • Should include records with other verification states
    • Should be chainable with other scopes

Acceptance Criteria

  • Create ee/spec/models/concerns/geo/verification_state_definition_spec.rb
  • Add comprehensive test coverage for all three new scopes
  • Test scope chaining behavior
  • Test edge cases (nil cursors, empty relations, etc.)
  • Ensure tests work with both simple and composite primary keys
  • Follow existing GitLab testing patterns and conventions

Context

This follow-up work was identified during the database review of MR !206339 (merged), where the new scopes were added to support composite primary key handling in Geo bulk verification operations.

References

Edited by 🤖 GitLab Bot 🤖