@@ -263,6 +263,118 @@ def exec(command, args)
263263 expect ( out ) . to include ( "Bundle complete!" )
264264 end
265265
266+ it "upgrade plugins version listed in gemfile" do
267+ update_repo2 do
268+ build_plugin "foo" , "1.4.0"
269+ build_plugin "foo" , "1.5.0"
270+ end
271+
272+ gemfile <<-G
273+ source '#{ file_uri_for ( gem_repo2 ) } '
274+ plugin 'foo', "1.4.0"
275+ gem 'rack', "1.0.0"
276+ G
277+
278+ bundle "install"
279+
280+ expect ( out ) . to include ( "Installing foo 1.4.0" )
281+ expect ( out ) . to include ( "Installed plugin foo" )
282+ expect ( out ) . to include ( "Bundle complete!" )
283+
284+ expect ( the_bundle ) . to include_gems ( "rack 1.0.0" )
285+ plugin_should_be_installed_with_version ( "foo" , "1.4.0" )
286+
287+ gemfile <<-G
288+ source '#{ file_uri_for ( gem_repo2 ) } '
289+ plugin 'foo', "1.5.0"
290+ gem 'rack', "1.0.0"
291+ G
292+
293+ bundle "install"
294+
295+ expect ( out ) . to include ( "Installing foo 1.5.0" )
296+ expect ( out ) . to include ( "Bundle complete!" )
297+
298+ expect ( the_bundle ) . to include_gems ( "rack 1.0.0" )
299+ plugin_should_be_installed_with_version ( "foo" , "1.5.0" )
300+ end
301+
302+ it "downgrade plugins version listed in gemfile" do
303+ update_repo2 do
304+ build_plugin "foo" , "1.4.0"
305+ build_plugin "foo" , "1.5.0"
306+ end
307+
308+ gemfile <<-G
309+ source '#{ file_uri_for ( gem_repo2 ) } '
310+ plugin 'foo', "1.5.0"
311+ gem 'rack', "1.0.0"
312+ G
313+
314+ bundle "install"
315+
316+ expect ( out ) . to include ( "Installing foo 1.5.0" )
317+ expect ( out ) . to include ( "Installed plugin foo" )
318+ expect ( out ) . to include ( "Bundle complete!" )
319+
320+ expect ( the_bundle ) . to include_gems ( "rack 1.0.0" )
321+ plugin_should_be_installed_with_version ( "foo" , "1.5.0" )
322+
323+ gemfile <<-G
324+ source '#{ file_uri_for ( gem_repo2 ) } '
325+ plugin 'foo', "1.4.0"
326+ gem 'rack', "1.0.0"
327+ G
328+
329+ bundle "install"
330+
331+ expect ( out ) . to include ( "Installing foo 1.4.0" )
332+ expect ( out ) . to include ( "Bundle complete!" )
333+
334+ expect ( the_bundle ) . to include_gems ( "rack 1.0.0" )
335+ plugin_should_be_installed_with_version ( "foo" , "1.4.0" )
336+ end
337+
338+ it "install only plugins not installed yet listed in gemfile" do
339+ gemfile <<-G
340+ source '#{ file_uri_for ( gem_repo2 ) } '
341+ plugin 'foo'
342+ gem 'rack', "1.0.0"
343+ G
344+
345+ 2 . times { bundle "install" }
346+
347+ expect ( out ) . to_not include ( "Fetching gem metadata" )
348+ expect ( out ) . to_not include ( "Installing foo" )
349+ expect ( out ) . to_not include ( "Installed plugin foo" )
350+
351+ expect ( out ) . to include ( "Bundle complete!" )
352+
353+ expect ( the_bundle ) . to include_gems ( "rack 1.0.0" )
354+ plugin_should_be_installed ( "foo" )
355+
356+ gemfile <<-G
357+ source '#{ file_uri_for ( gem_repo2 ) } '
358+ plugin 'foo'
359+ plugin 'kung-foo'
360+ gem 'rack', "1.0.0"
361+ G
362+
363+ bundle "install"
364+
365+ expect ( out ) . to include ( "Installing kung-foo" )
366+ expect ( out ) . to include ( "Installed plugin kung-foo" )
367+
368+ expect ( out ) . to_not include ( "Installing foo" )
369+ expect ( out ) . to_not include ( "Installed plugin foo" )
370+
371+ expect ( out ) . to include ( "Bundle complete!" )
372+
373+ expect ( the_bundle ) . to include_gems ( "rack 1.0.0" )
374+ plugin_should_be_installed ( "foo" )
375+ plugin_should_be_installed ( "kung-foo" )
376+ end
377+
266378 it "accepts git sources" do
267379 build_git "ga-plugin" do |s |
268380 s . write "plugins.rb"
@@ -327,7 +439,9 @@ def exec(command, args)
327439 RUBY
328440
329441 ruby code , env : { "BUNDLER_VERSION" => Bundler ::VERSION }
330- expect ( local_plugin_gem ( "foo-1.0" , "plugins.rb" ) ) . to exist
442+
443+ allow ( Bundler ::SharedHelpers ) . to receive ( :find_gemfile ) . and_return ( bundled_app_gemfile )
444+ plugin_should_be_installed ( "foo" )
331445 end
332446 end
333447
0 commit comments