Giter Site home page Giter Site logo

Comments (3)

jgrau avatar jgrau commented on June 25, 2024 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.

samuelgiles avatar samuelgiles commented on June 25, 2024 1

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.

jigarius avatar jigarius commented on June 25, 2024

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 photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.