Skip to content

Commit 182b76d

Browse files
committed
Fix missing gem specs test
Apparently missing gem specs are only populated if the platform for the declared gem is one of the platforms Bundler is installing for. Since `:rbx` wasn't one of the added platforms, the gem was completely being ignored. However, we can't just add `:rbx` as a platform to the lockfile since (a) it is not a platform supported by RubyGems anymore, and (b) it isn't a platform that Sorbet has any support for. Of the platforms supported by RubyGems, the one that we can also resolve Sorbet against seems only to be the `:java` platform. So, adding the gem that we expect to be missing as a `:java` platform gem and then adding `:java` as a platform to the lockfile resurfaces the missing gem spec again.
1 parent 7f51c64 commit 182b76d

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

spec/tapioca/cli/gem_spec.rb

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -767,11 +767,15 @@ class Secret; end
767767

768768
it "must not generate RBIs for missing gem specs" do
769769
@project.write_gemfile!(<<~GEMFILE, append: true)
770-
platform :rbx do
770+
platform :java do
771771
gem "sidekiq", "=7.1.2"
772772
end
773773
GEMFILE
774774

775+
# We need to add the platform to the lock file so that bundler includes the gem
776+
# but it won't be materializable on the current platform (since we are not on JRuby)
777+
@project.exec("bundle lock --add-platform java")
778+
775779
@project.bundle_install!
776780

777781
result = @project.tapioca("gem --all")

0 commit comments

Comments
 (0)