Comments (3)
To anyone that finds this post in the quest to mark spec files as typed: there's a really good post here: https://stackoverflow.com/a/76548429. I managed to enable sorbet for my specs with these shims:
sorbet/rbi/shims/rspec.rbi:
# typed: strict
# frozen_string_literal: true
module RSpec
sig do
params(
args: T.untyped, # rubocop:disable Sorbet/ForbidTUntyped
example_group_block: T.proc.bind(T.untyped).void, # rubocop:disable Sorbet/ForbidTUntyped
).void
end
def self.describe(*args, &example_group_block)
end
sig do
params(
name: String,
args: T.untyped, # rubocop:disable Sorbet/ForbidTUntyped
block: T.proc.bind(T.untyped).void, # rubocop:disable Sorbet/ForbidTUntyped
).void
end
def self.shared_examples(name, *args, &block)
end
end
sorbet/rbi/shims/factory_bot.rbi:
# typed: strict
# frozen_string_literal: true
module FactoryBot
sig do
params(
block: T.proc.bind(T.untyped).void, # rubocop:disable Sorbet/ForbidTUntyped
).void
end
def self.define(&block)
end
end
from rspec-sorbet.
Hey @jigarius, apologies for the delayed response I'm not sure how I missed this. Enabling # typed: true
within specs isn't something the rspec-sorbet gem does just yet, I'd love it to do so but I think the DSL might make it tricky.
For the moment the gem is focused on letting you pass instance/class/object doubles into methods by semi-intelligently inspecting the Sorbet's runtime errors to check if the double is_a?
double of the thing the method expects.
from rspec-sorbet.
Errors had temporarily disappeared, but I noticed that it was because # typed
had somehow become false
. The problem persists.
from rspec-sorbet.
Related Issues (6)
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from rspec-sorbet.