github.com/nextlinux/gosbom@v0.81.1-0.20230627115839-1ff50c281391/gosbom/pkg/cataloger/ruby/parse_gemspec_test.go (about) 1 package ruby 2 3 import ( 4 "testing" 5 6 "github.com/nextlinux/gosbom/gosbom/file" 7 "github.com/nextlinux/gosbom/gosbom/pkg" 8 "github.com/nextlinux/gosbom/gosbom/pkg/cataloger/internal/pkgtest" 9 ) 10 11 func TestParseGemspec(t *testing.T) { 12 fixture := "test-fixtures/bundler.gemspec" 13 14 locations := file.NewLocationSet(file.NewLocation(fixture)) 15 16 var expectedPkg = pkg.Package{ 17 Name: "bundler", 18 Version: "2.1.4", 19 PURL: "pkg:gem/bundler@2.1.4", 20 Locations: locations, 21 Type: pkg.GemPkg, 22 Licenses: pkg.NewLicenseSet( 23 pkg.NewLicenseFromLocations("MIT", file.NewLocation(fixture)), 24 ), 25 Language: pkg.Ruby, 26 MetadataType: pkg.GemMetadataType, 27 Metadata: pkg.GemMetadata{ 28 Name: "bundler", 29 Version: "2.1.4", 30 Files: []string{"exe/bundle", "exe/bundler"}, 31 Authors: []string{"André Arko", "Samuel Giddins", "Colby Swandale", "Hiroshi Shibata", "David Rodríguez", "Grey Baker", "Stephanie Morillo", "Chris Morris", "James Wen", "Tim Moore", "André Medeiros", "Jessica Lynn Suttles", "Terence Lee", "Carl Lerche", "Yehuda Katz"}, 32 Homepage: "https://bundler.io", 33 }, 34 } 35 36 pkgtest.TestFileParser(t, fixture, parseGemSpecEntries, []pkg.Package{expectedPkg}, nil) 37 }