@@ -702,6 +702,65 @@ def test_generate_lockfile_dependency_with_platform
702702 end
703703 end
704704
705+ def test_generate_lockfile__gems_not_included_in_gemfile
706+ mktmpdir do |tmpdir |
707+ config_path = tmpdir / 'rbs_collection.yaml'
708+ config_path . write [ CONFIG , <<~YAML ] . join ( "\n " )
709+ sources:
710+ - type: git
711+ name: ruby/gem_rbs_collection
712+ remote: https://github.com/ruby/gem_rbs_collection.git
713+ revision: cde6057e7546843ace6420c5783dd945c6ccda54
714+ repo_dir: gems
715+ path: '.gem_rbs_collection'
716+ gems:
717+ - name: ast
718+ YAML
719+ gemfile_path = tmpdir / 'Gemfile'
720+ gemfile_path . write <<~GEMFILE
721+ source 'https://rubygems.org'
722+ GEMFILE
723+ gemfile_lock_path = tmpdir / 'Gemfile.lock'
724+ gemfile_lock_path . write <<~GEMFILE_LOCK
725+ GEM
726+ remote: https://rubygems.org/
727+ specs:
728+
729+ PLATFORMS
730+ x86_64-linux
731+
732+ DEPENDENCIES
733+
734+ BUNDLED WITH
735+ 2.2.0
736+ GEMFILE_LOCK
737+
738+ definition = Bundler ::Definition . build ( gemfile_path , gemfile_lock_path , false )
739+ _config , lockfile = RBS ::Collection ::Config . generate_lockfile ( config_path : config_path , definition : definition )
740+ string = YAML . dump ( lockfile . to_lockfile )
741+
742+ assert_config <<~YAML , string
743+ sources:
744+ - type: git
745+ name: ruby/gem_rbs_collection
746+ remote: https://github.com/ruby/gem_rbs_collection.git
747+ revision: cde6057e7546843ace6420c5783dd945c6ccda54
748+ repo_dir: gems
749+ path: ".gem_rbs_collection"
750+ gemfile_lock_path: 'Gemfile.lock'
751+ gems:
752+ - name: ast
753+ version: "2.4"
754+ source:
755+ name: ruby/gem_rbs_collection
756+ remote: https://github.com/ruby/gem_rbs_collection.git
757+ revision: cde6057e7546843ace6420c5783dd945c6ccda54
758+ repo_dir: gems
759+ type: git
760+ YAML
761+ end
762+ end
763+
705764 private def assert_config ( expected_str , actual_str )
706765 assert_equal YAML . load ( expected_str ) , YAML . load ( actual_str )
707766 end
0 commit comments