@@ -75,25 +75,81 @@ func testBuildpackYML(t *testing.T, context spec.G, it spec.S) {
7575
7676 Eventually (container ).Should (BeAvailable ())
7777 Eventually (container ).Should (Serve (ContainSubstring (fmt .Sprintf ("/layers/%s/bundler/bin/bundler" , strings .ReplaceAll (settings .Buildpack .ID , "/" , "_" )))).OnPort (8080 ))
78- Eventually (container ).Should (Serve (MatchRegexp (`Bundler version 2\.5 \.\d+` )).OnPort (8080 ))
78+ Eventually (container ).Should (Serve (MatchRegexp (`Bundler version 2\.\d+ \.\d+` )).OnPort (8080 ))
7979
8080 Expect (logs ).To (ContainLines (
8181 MatchRegexp (fmt .Sprintf (`%s \d+\.\d+\.\d+` , settings .Buildpack .Name )),
8282 " Resolving Bundler version" ,
8383 " Candidate version sources (in priority order):" ,
84- " buildpack.yml -> \" 2.5. *\" " ,
84+ " buildpack.yml -> \" 2.*\" " ,
8585 " <unknown> -> \" \" " ,
8686 ))
8787 Expect (logs ).To (ContainLines (
88- MatchRegexp (` Selected bundler version \(using buildpack\.yml\): 2\.5 \.\d+` ),
88+ MatchRegexp (` Selected bundler version \(using buildpack\.yml\): 2\.\d+ \.\d+` ),
8989 ))
9090 Expect (logs ).To (ContainLines (
9191 " WARNING: Setting the Bundler version through buildpack.yml will be deprecated soon in Bundler Buildpack v2.0.0." ,
9292 " Please specify the version through the $BP_BUNDLER_VERSION environment variable instead. See README.md for more information." ,
9393 ))
9494 Expect (logs ).To (ContainLines (
9595 " Executing build process" ,
96- MatchRegexp (` Installing Bundler 2\.5\.\d+` ),
96+ MatchRegexp (` Installing Bundler 2\.\d+\.\d+` ),
97+ MatchRegexp (` Completed in \d+\.?\d*` ),
98+ ))
99+ Expect (logs ).To (ContainLines (
100+ " Configuring build environment" ,
101+ MatchRegexp (fmt .Sprintf (` GEM_PATH -> "\$GEM_PATH:/layers/%s/bundler"` , strings .ReplaceAll (settings .Buildpack .ID , "/" , "_" ))),
102+ ))
103+ Expect (logs ).To (ContainLines (
104+ " Configuring launch environment" ,
105+ MatchRegexp (fmt .Sprintf (` GEM_PATH -> "\$GEM_PATH:/layers/%s/bundler"` , strings .ReplaceAll (settings .Buildpack .ID , "/" , "_" ))),
106+ ))
107+ })
108+
109+ it ("installs Bundler 4.x when specified in buildpack.yml" , func () {
110+ var err error
111+ source , err = occam .Source (filepath .Join ("testdata" , "buildpack_yml_version_4" ))
112+ Expect (err ).NotTo (HaveOccurred ())
113+
114+ var logs fmt.Stringer
115+ image , logs , err = pack .WithNoColor ().Build .
116+ WithPullPolicy ("never" ).
117+ WithBuildpacks (
118+ settings .Buildpacks .MRI .Online ,
119+ settings .Buildpacks .Bundler .Online ,
120+ settings .Buildpacks .BuildPlan .Online ,
121+ ).
122+ Execute (name , source )
123+ Expect (err ).ToNot (HaveOccurred (), logs .String )
124+
125+ container , err = docker .Container .Run .
126+ WithEnv (map [string ]string {"PORT" : "8080" }).
127+ WithPublish ("8080" ).
128+ WithPublishAll ().
129+ WithCommand ("ruby run.rb" ).Execute (image .ID )
130+ Expect (err ).NotTo (HaveOccurred ())
131+
132+ Eventually (container ).Should (BeAvailable ())
133+ Eventually (container ).Should (Serve (ContainSubstring (fmt .Sprintf ("/layers/%s/bundler/bin/bundler" , strings .ReplaceAll (settings .Buildpack .ID , "/" , "_" )))).OnPort (8080 ))
134+ Eventually (container ).Should (Serve (MatchRegexp (`4\.\d+\.\d+ \(` )).OnPort (8080 ))
135+
136+ Expect (logs ).To (ContainLines (
137+ MatchRegexp (fmt .Sprintf (`%s \d+\.\d+\.\d+` , settings .Buildpack .Name )),
138+ " Resolving Bundler version" ,
139+ " Candidate version sources (in priority order):" ,
140+ " buildpack.yml -> \" 4.*\" " ,
141+ " <unknown> -> \" \" " ,
142+ ))
143+ Expect (logs ).To (ContainLines (
144+ MatchRegexp (` Selected bundler version \(using buildpack\.yml\): 4\.\d+\.\d+` ),
145+ ))
146+ Expect (logs ).To (ContainLines (
147+ " WARNING: Setting the Bundler version through buildpack.yml will be deprecated soon in Bundler Buildpack v2.0.0." ,
148+ " Please specify the version through the $BP_BUNDLER_VERSION environment variable instead. See README.md for more information." ,
149+ ))
150+ Expect (logs ).To (ContainLines (
151+ " Executing build process" ,
152+ MatchRegexp (` Installing Bundler 4\.\d+\.\d+` ),
97153 MatchRegexp (` Completed in \d+\.?\d*` ),
98154 ))
99155 Expect (logs ).To (ContainLines (
0 commit comments