Sha256: 6ee80ae98a3a7e17ff16ef4d099845d3a406f3c98d62836775fef18d23593595

Contents?: true

Size: 1.03 KB

Versions: 3

Compression:

Stored size: 1.03 KB

Contents

![rspec-sorbet](https://user-images.githubusercontent.com/2643026/63100456-02c12c00-bf6f-11e9-8430-630a27bc6e42.png)

# RSpec Sorbet [![Gem Version](https://badge.fury.io/rb/rspec-sorbet.svg)](https://badge.fury.io/rb/rspec-sorbet)

A small gem consisting of helpers for using Sorbet & RSpec together.

## Install

`gem 'rspec-sorbet'`

## Usage

In your `spec_helper.rb` you need to first add a `require`:
```ruby
require 'rspec/sorbet'
```

### Allowing Instance Doubles

Out of the box if you're using `instance_double`'s in your tests you'll encounter errors such as the following:

```
 TypeError:
       Parameter 'my_parameter': Expected type MyObject, got type RSpec::Mocks::InstanceVerifyingDouble with value #<InstanceDouble(MyObject) (anonymous)>
       Caller: /Users/samuelgiles/Documents/Projects/Clients/Bellroy/bellroy/spec/lib/checkout/use_cases/my_use_case.rb:9
```

Drop the following into your `spec_helper.rb` to allow `instance_double` to be used without breaking type checking:

```ruby
RSpec::Sorbet.allow_instance_doubles!
```

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
rspec-sorbet-1.2.1 README.md
rspec-sorbet-1.2.0 README.md
rspec-sorbet-1.1.0 README.md