{"id":13878794,"url":"https://github.com/samuelgiles/rspec-sorbet","last_synced_at":"2025-10-08T19:12:08.003Z","repository":{"id":44694362,"uuid":"202551351","full_name":"samuelgiles/rspec-sorbet","owner":"samuelgiles","description":"A small gem consisting of helpers for using Sorbet \u0026 RSpec together.","archived":false,"fork":false,"pushed_at":"2023-03-24T08:11:48.000Z","size":1552,"stargazers_count":41,"open_issues_count":4,"forks_count":9,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-07-28T13:32:57.470Z","etag":null,"topics":["rails","rspec","ruby","sorbet","testing","type-safety","types"],"latest_commit_sha":null,"homepage":null,"language":"Ruby","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/samuelgiles.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null}},"created_at":"2019-08-15T14:00:44.000Z","updated_at":"2025-03-10T17:09:49.000Z","dependencies_parsed_at":"2024-01-13T20:40:16.159Z","dependency_job_id":"a4a16347-6b91-40a4-807d-ae1b9ed20b96","html_url":"https://github.com/samuelgiles/rspec-sorbet","commit_stats":null,"previous_names":[],"tags_count":11,"template":false,"template_full_name":null,"purl":"pkg:github/samuelgiles/rspec-sorbet","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/samuelgiles%2Frspec-sorbet","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/samuelgiles%2Frspec-sorbet/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/samuelgiles%2Frspec-sorbet/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/samuelgiles%2Frspec-sorbet/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/samuelgiles","download_url":"https://codeload.github.com/samuelgiles/rspec-sorbet/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/samuelgiles%2Frspec-sorbet/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":270742043,"owners_count":24637504,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-08-16T02:00:11.002Z","response_time":91,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["rails","rspec","ruby","sorbet","testing","type-safety","types"],"created_at":"2024-08-06T08:02:00.203Z","updated_at":"2025-10-08T19:12:02.969Z","avatar_url":"https://github.com/samuelgiles.png","language":"Ruby","funding_links":[],"categories":["Ruby"],"sub_categories":[],"readme":"![rspec-sorbet](https://user-images.githubusercontent.com/2643026/63100456-02c12c00-bf6f-11e9-8430-630a27bc6e42.png)\n\n# RSpec Sorbet [![Gem Version](https://badge.fury.io/rb/rspec-sorbet.svg)](https://badge.fury.io/rb/rspec-sorbet) ![CI Badge](https://github.com/samuelgiles/rspec-sorbet/workflows/Continuous%20Integration/badge.svg)\n\nA small gem consisting of helpers for using Sorbet \u0026 RSpec together.\n\n## Install\n\n`gem 'rspec-sorbet'`\n\n## Usage\n\nIn your `spec_helper.rb` you need to first add a `require`:\n```ruby\nrequire 'rspec/sorbet'\n```\n\n### Allowing Instance/Class/Object Doubles\n\nOut of the box if you're using `instance_double`, `class_double` or `object_double` in your specs you'll encounter errors such as the following:\n\n```ruby\n TypeError:\n       Parameter 'my_parameter': Expected type MyObject, got type RSpec::Mocks::InstanceVerifyingDouble with value #\u003cInstanceDouble(MyObject) (anonymous)\u003e\n       Caller: /Users/samuelgiles/Documents/Projects/Clients/Bellroy/bellroy/spec/lib/checkout/use_cases/my_use_case.rb:9\n```\n\nDrop the following into your `spec_helper.rb` to allow doubles to be used without breaking type checking:\n\n```ruby\nRSpec::Sorbet.allow_doubles!\n```\n\n### `eq` matcher usage with `T::Struct`'s\n\nUsing the [`eq` matcher](https://www.rubydoc.info/github/rspec/rspec-expectations/RSpec%2FMatchers:eq) to compare [`T::Struct`'s](https://sorbet.org/docs/tstruct) might not behave as you'd expect whereby two separate instances of the same struct class with identical attributes are not `==` out of the box. The standalone [sorbet-struct-comparable](https://github.com/samuelgiles/sorbet-struct-comparable) gem may be of interest if you are looking for a simple attribute based comparison that will help make the `eq` matcher behave as you expect.\n\n### Specifying a custom validation handler\n\nYou can customise the handler of Sorbet validation errors if you so desire.\n\n\n```ruby\ndef handler(signature, opts)\n  raise MyCustomException, \"The options were #{opts}\"\nend\n\nT::Configuration.call_validation_error_handler = handler\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsamuelgiles%2Frspec-sorbet","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsamuelgiles%2Frspec-sorbet","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsamuelgiles%2Frspec-sorbet/lists"}