@@ -22,7 +22,7 @@ class AnnotationsTest < SpecWithProject
22
22
23
23
assert_stdout_equals ( <<~OUT , result )
24
24
Retrieving index from central repository... Done
25
- Listing gems from bundle ... Done
25
+ Listing gems from Gemfile.lock ... Done
26
26
Removing annotations for gems that have been removed... Nothing to do
27
27
Fetching gem annotations from central repository... Nothing to do
28
28
OUT
@@ -398,6 +398,51 @@ class Foo; end
398
398
399
399
repo . destroy!
400
400
end
401
+
402
+ it "gets annotations if application uses a gems.rb" do
403
+ gemfile_content = @project . read ( "Gemfile" )
404
+ gemfile_lock = @project . read ( "Gemfile.lock" )
405
+
406
+ @project . remove! ( "Gemfile" )
407
+ @project . remove! ( "Gemfile.lock" )
408
+
409
+ @project . write! ( "gems.rb" , <<~RBI )
410
+ source("https://rubygems.org")
411
+
412
+ gemspec name: "tapioca", path: "#{ MockProject ::TAPIOCA_PATH } "
413
+ RBI
414
+ @project . bundle_install!
415
+
416
+ repo = create_repo ( {
417
+ rbi : <<~RBI ,
418
+ # typed: true
419
+
420
+ class AnnotationForRBI; end
421
+ RBI
422
+ } )
423
+
424
+ result = @project . tapioca ( "annotations --sources #{ repo . absolute_path } " )
425
+ assert_stdout_includes ( result , "create sorbet/rbi/annotations/rbi.rbi" )
426
+ assert_project_annotation_equal ( "sorbet/rbi/annotations/rbi.rbi" , <<~RBI )
427
+ # typed: true
428
+
429
+ # DO NOT EDIT MANUALLY
430
+ # This file was pulled from a central RBI files repository.
431
+ # Please run `bin/tapioca annotations` to update it.
432
+
433
+ class AnnotationForRBI; end
434
+ RBI
435
+
436
+ assert_success_status ( result )
437
+
438
+ @project . remove! ( "gems.rb" )
439
+ @project . remove! ( "gems.lock" )
440
+ @project . write! ( "Gemfile" , gemfile_content )
441
+ @project . write! ( "Gemfile.lock" , gemfile_lock )
442
+ @project . bundle_install!
443
+
444
+ repo . destroy!
445
+ end
401
446
end
402
447
403
448
private
0 commit comments