diff options
Diffstat (limited to 'spec/bundler/plugins/install_spec.rb')
-rw-r--r-- | spec/bundler/plugins/install_spec.rb | 58 |
1 files changed, 55 insertions, 3 deletions
diff --git a/spec/bundler/plugins/install_spec.rb b/spec/bundler/plugins/install_spec.rb index 9304d78062..afc6087c1b 100644 --- a/spec/bundler/plugins/install_spec.rb +++ b/spec/bundler/plugins/install_spec.rb @@ -11,7 +11,7 @@ RSpec.describe "bundler plugin install" do it "shows proper message when gem in not found in the source" do bundle "plugin install no-foo --source file://#{gem_repo1}" - expect(out).to include("Could not find") + expect(err).to include("Could not find") plugin_should_not_be_installed("no-foo") end @@ -22,6 +22,18 @@ RSpec.describe "bundler plugin install" do plugin_should_be_installed("foo") end + context "plugin is already installed" do + before do + bundle "plugin install foo --source file://#{gem_repo2}" + end + + it "doesn't install plugin again" do + bundle "plugin install foo --source file://#{gem_repo2}" + expect(out).not_to include("Installing plugin foo") + expect(out).not_to include("Installed plugin foo") + end + end + it "installs multiple plugins" do bundle "plugin install foo kung-foo --source file://#{gem_repo2}" @@ -86,7 +98,7 @@ RSpec.describe "bundler plugin install" do bundle "plugin install charlie --source file://#{gem_repo2}" - expect(out).to include("plugins.rb was not found") + expect(err).to include("plugins.rb was not found") expect(global_plugin_gem("charlie-1.0")).not_to be_directory @@ -122,6 +134,24 @@ RSpec.describe "bundler plugin install" do expect(out).to include("Installed plugin foo") plugin_should_be_installed("foo") end + + it "installs form a local git source" do + build_git "foo" do |s| + s.write "plugins.rb" + end + + bundle "plugin install foo --local_git #{lib_path("foo-1.0")}" + + expect(out).to include("Installed plugin foo") + plugin_should_be_installed("foo") + end + + it "raises an error when both git and local git sources are specified" do + bundle "plugin install foo --local_git /phony/path/project --git git@gitphony.com:/repo/project" + + expect(exitstatus).not_to eq(0) if exitstatus + expect(err).to eq("Remote and local plugin git sources can't be both specified") + end end context "Gemfile eval" do @@ -147,7 +177,7 @@ RSpec.describe "bundler plugin install" do build_plugin "foo", "1.1.0" end - install_gemfile <<-G + gemfile <<-G source 'file://#{gem_repo2}' plugin 'foo', "1.0" G @@ -173,6 +203,28 @@ RSpec.describe "bundler plugin install" do expect(out).to include("Installed plugin ga-plugin") plugin_should_be_installed("ga-plugin") end + + context "in deployment mode" do + it "installs plugins" do + install_gemfile! <<-G + source 'file://#{gem_repo2}' + gem 'rack', "1.0.0" + G + + install_gemfile! <<-G, forgotten_command_line_options(:deployment => true) + source 'file://#{gem_repo2}' + plugin 'foo' + gem 'rack', "1.0.0" + G + + expect(out).to include("Installed plugin foo") + + expect(out).to include("Bundle complete!") + + expect(the_bundle).to include_gems("rack 1.0.0") + plugin_should_be_installed("foo") + end + end end context "inline gemfiles" do |