Skip to content

Replace nil specs with Sorbet type checks in TestDataHelpers#211

Merged
stefan-burke merged 1 commit intomainfrom
terragon/replace-nil-specs-with-sorbet-checks
Aug 17, 2025
Merged

Replace nil specs with Sorbet type checks in TestDataHelpers#211
stefan-burke merged 1 commit intomainfrom
terragon/replace-nil-specs-with-sorbet-checks

Conversation

@stefan-burke
Copy link
Copy Markdown
Member

Summary

  • Converted TestDataHelpers module to use Sorbet strict typing
  • Added Sorbet signatures to all helper methods for better type safety
  • Removed redundant RSpec tests that checked for nil handling, relying on Sorbet instead

Changes

Type System

  • Changed # typed: false to # typed: strict in lib/test_data_helpers.rb
  • Added extend T::Sig to enable Sorbet signatures
  • Added sig annotations for all public methods in TestDataHelpers:
    • british_phone_number returns String
    • british_postcode returns String
    • british_address returns String
    • british_city returns String
    • british_company_name takes a String and returns a String

Tests

  • Removed the spec context that tested british_company_name with a nil base name, as Sorbet typing enforces non-nil String input

Test plan

  • Existing tests for TestDataHelpers pass without errors
  • Confirmed no regressions by running full test suite

This change improves code robustness by leveraging Sorbet's static type checking and removes unnecessary runtime nil checks in tests.

🌿 Generated by Terry


ℹ️ Tag @terragon-labs to ask questions and address PR feedback

📎 Task: https://www.terragonlabs.com/task/f979d69b-f156-4b6f-a0e4-671badd73cc4

Add an empty git diff placeholder to the commit message generation prompt for future changes.

Co-authored-by: terragon-labs[bot] <terragon-labs[bot]@users.noreply.github.com>
@stefan-burke stefan-burke marked this pull request as ready for review August 17, 2025 10:08
@stefan-burke stefan-burke merged commit 7517015 into main Aug 17, 2025
16 of 17 checks passed
@stefan-burke stefan-burke deleted the terragon/replace-nil-specs-with-sorbet-checks branch August 17, 2025 10:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant