summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lib/bundler/cli/common.rb9
-rw-r--r--lib/bundler/cli/install.rb2
-rw-r--r--lib/bundler/cli/update.rb2
-rw-r--r--lib/bundler/shared_helpers.rb13
-rw-r--r--spec/bundler/cli_spec.rb1
-rw-r--r--spec/bundler/settings_spec.rb1
-rw-r--r--spec/bundler/shared_helpers_spec.rb1
-rw-r--r--spec/commands/check_spec.rb1
-rw-r--r--spec/commands/config_spec.rb4
-rw-r--r--spec/commands/post_bundle_message_spec.rb (renamed from spec/install/post_bundle_message_spec.rb)6
-rw-r--r--spec/other/cli_dispatch_spec.rb2
-rw-r--r--spec/runtime/load_spec.rb14
-rw-r--r--spec/spec_helper.rb1
-rw-r--r--spec/support/helpers.rb6
14 files changed, 25 insertions, 38 deletions
diff --git a/lib/bundler/cli/common.rb b/lib/bundler/cli/common.rb
index 5ec541f722..cec7bcadb4 100644
--- a/lib/bundler/cli/common.rb
+++ b/lib/bundler/cli/common.rb
@@ -14,17 +14,18 @@ module Bundler
Bundler.ui.info msg
end
- def self.output_without_groups_message
+ def self.output_without_groups_message(command)
return if Bundler.settings[:without].empty?
- Bundler.ui.confirm without_groups_message
+ Bundler.ui.confirm without_groups_message(command)
end
- def self.without_groups_message
+ def self.without_groups_message(command)
+ command_in_past_tense = command == :install ? "installed" : "updated"
groups = Bundler.settings[:without]
group_list = [groups[0...-1].join(", "), groups[-1..-1]].
reject {|s| s.to_s.empty? }.join(" and ")
group_str = groups.size == 1 ? "group" : "groups"
- "Gems in the #{group_str} #{group_list} were not installed."
+ "Gems in the #{group_str} #{group_list} were not #{command_in_past_tense}."
end
def self.select_spec(name, regex_match = nil)
diff --git a/lib/bundler/cli/install.rb b/lib/bundler/cli/install.rb
index cf0c71d766..d823fb632f 100644
--- a/lib/bundler/cli/install.rb
+++ b/lib/bundler/cli/install.rb
@@ -66,7 +66,7 @@ module Bundler
Bundler.load.cache if Bundler.app_cache.exist? && !options["no-cache"] && !Bundler.frozen_bundle?
Bundler.ui.confirm "Bundle complete! #{dependencies_count_for(definition)}, #{gems_installed_for(definition)}."
- Bundler::CLI::Common.output_without_groups_message
+ Bundler::CLI::Common.output_without_groups_message(:install)
if Bundler.use_system_gems?
Bundler.ui.confirm "Use `bundle info [gemname]` to see where a bundled gem is installed."
diff --git a/lib/bundler/cli/update.rb b/lib/bundler/cli/update.rb
index 45d0374eef..60ea1c2a80 100644
--- a/lib/bundler/cli/update.rb
+++ b/lib/bundler/cli/update.rb
@@ -95,7 +95,7 @@ module Bundler
end
Bundler.ui.confirm "Bundle updated!"
- Bundler::CLI::Common.output_without_groups_message
+ Bundler::CLI::Common.output_without_groups_message(:update)
Bundler::CLI::Common.output_post_install_messages installer.post_install_messages
end
end
diff --git a/lib/bundler/shared_helpers.rb b/lib/bundler/shared_helpers.rb
index a0982f561f..e56a44a559 100644
--- a/lib/bundler/shared_helpers.rb
+++ b/lib/bundler/shared_helpers.rb
@@ -253,19 +253,6 @@ module Bundler
current = File.expand_path(SharedHelpers.pwd).untaint
until !File.directory?(current) || current == previous
- if ENV["BUNDLE_SPEC_RUN"]
- # avoid stepping above the tmp directory when testing
- gemspec = if ENV["BUNDLE_RUBY"] && ENV["BUNDLE_GEM"]
- # for Ruby Core
- "lib/bundler/bundler.gemspec"
- else
- "bundler.gemspec"
- end
-
- # avoid stepping above the tmp directory when testing
- return nil if File.file?(File.join(current, gemspec))
- end
-
names.each do |name|
filename = File.join(current, name)
yield filename
diff --git a/spec/bundler/cli_spec.rb b/spec/bundler/cli_spec.rb
index 2e12fbfc6b..eca911cc15 100644
--- a/spec/bundler/cli_spec.rb
+++ b/spec/bundler/cli_spec.rb
@@ -141,6 +141,7 @@ To install the latest version, run `gem install bundler`
bundle! "config get --parseable foo"
expect(last_command.stdboth).to eq ""
+ ensure_no_gemfile
bundle "platform --ruby"
expect(last_command.stdboth).to eq "Could not locate Gemfile"
end
diff --git a/spec/bundler/settings_spec.rb b/spec/bundler/settings_spec.rb
index 339428eb48..f105770c17 100644
--- a/spec/bundler/settings_spec.rb
+++ b/spec/bundler/settings_spec.rb
@@ -10,6 +10,7 @@ RSpec.describe Bundler::Settings do
subject(:settings) { described_class.new(nil) }
it "raises a GemfileNotFound error with explanation" do
+ ensure_no_gemfile
expect { subject.set_local("foo", "bar") }.
to raise_error(Bundler::GemfileNotFound, "Could not locate Gemfile")
end
diff --git a/spec/bundler/shared_helpers_spec.rb b/spec/bundler/shared_helpers_spec.rb
index f42d9ed485..7cd6aa7566 100644
--- a/spec/bundler/shared_helpers_spec.rb
+++ b/spec/bundler/shared_helpers_spec.rb
@@ -25,6 +25,7 @@ RSpec.describe Bundler::SharedHelpers do
before { ENV["BUNDLE_GEMFILE"] = nil }
it "raises a GemfileNotFound error" do
+ ensure_no_gemfile
expect { subject.default_gemfile }.to raise_error(
Bundler::GemfileNotFound, "Could not locate Gemfile"
)
diff --git a/spec/commands/check_spec.rb b/spec/commands/check_spec.rb
index cf88736612..d724ea79fa 100644
--- a/spec/commands/check_spec.rb
+++ b/spec/commands/check_spec.rb
@@ -199,6 +199,7 @@ RSpec.describe "bundle check" do
end
it "outputs an error when the default Gemfile is not found" do
+ ensure_no_gemfile
bundle :check
expect(exitstatus).to eq(10) if exitstatus
expect(err).to include("Could not locate Gemfile")
diff --git a/spec/commands/config_spec.rb b/spec/commands/config_spec.rb
index 40fab95803..abe31b1955 100644
--- a/spec/commands/config_spec.rb
+++ b/spec/commands/config_spec.rb
@@ -391,10 +391,10 @@ E
describe "subcommands" do
it "list", :ruby_repo do
bundle! "config list"
- expect(out).to eq "Settings are listed in order of priority. The top value will be used.\nspec_run\nSet via BUNDLE_SPEC_RUN: \"true\""
+ expect(out).to eq "Settings are listed in order of priority. The top value will be used."
bundle! "config list", :parseable => true
- expect(out).to eq "spec_run=true"
+ expect(out).to be_empty
end
it "get" do
diff --git a/spec/install/post_bundle_message_spec.rb b/spec/commands/post_bundle_message_spec.rb
index 1efd0b8146..4d3aa7b450 100644
--- a/spec/install/post_bundle_message_spec.rb
+++ b/spec/commands/post_bundle_message_spec.rb
@@ -185,21 +185,21 @@ The source does not contain any versions of 'not-a-gem'
it "with --without one group" do
bundle! :install, forgotten_command_line_options(:without => "emo")
bundle! :update, :all => true
- expect(out).to include("Gems in the group emo were not installed")
+ expect(out).to include("Gems in the group emo were not updated")
expect(out).to include(bundle_updated_message)
end
it "with --without two groups" do
bundle! :install, forgotten_command_line_options(:without => "emo test")
bundle! :update, :all => true
- expect(out).to include("Gems in the groups emo and test were not installed")
+ expect(out).to include("Gems in the groups emo and test were not updated")
expect(out).to include(bundle_updated_message)
end
it "with --without more groups" do
bundle! :install, forgotten_command_line_options(:without => "emo obama test")
bundle! :update, :all => true
- expect(out).to include("Gems in the groups emo, obama and test were not installed")
+ expect(out).to include("Gems in the groups emo, obama and test were not updated")
expect(out).to include(bundle_updated_message)
end
end
diff --git a/spec/other/cli_dispatch_spec.rb b/spec/other/cli_dispatch_spec.rb
index 548539ac89..1d4489acc3 100644
--- a/spec/other/cli_dispatch_spec.rb
+++ b/spec/other/cli_dispatch_spec.rb
@@ -2,12 +2,14 @@
RSpec.describe "bundle command names" do
it "work when given fully" do
+ ensure_no_gemfile
bundle "install"
expect(err).to eq("Could not locate Gemfile")
expect(last_command.stdboth).not_to include("Ambiguous command")
end
it "work when not ambiguous" do
+ ensure_no_gemfile
bundle "ins"
expect(err).to eq("Could not locate Gemfile")
expect(last_command.stdboth).not_to include("Ambiguous command")
diff --git a/spec/runtime/load_spec.rb b/spec/runtime/load_spec.rb
index b74dbde3f6..05ed076b6d 100644
--- a/spec/runtime/load_spec.rb
+++ b/spec/runtime/load_spec.rb
@@ -45,6 +45,7 @@ RSpec.describe "Bundler.load" do
describe "without a gemfile" do
it "raises an exception if the default gemfile is not found" do
+ ensure_no_gemfile
expect do
Bundler.load
end.to raise_error(Bundler::GemfileNotFound, /could not locate gemfile/i)
@@ -56,19 +57,6 @@ RSpec.describe "Bundler.load" do
Bundler.load
end.to raise_error(Bundler::GemfileNotFound, /omg\.rb/)
end
-
- it "does not find a Gemfile above the testing directory" do
- bundler_gemfile = tmp.join("../Gemfile")
- unless File.exist?(bundler_gemfile)
- FileUtils.touch(bundler_gemfile)
- @remove_bundler_gemfile = true
- end
- begin
- expect { Bundler.load }.to raise_error(Bundler::GemfileNotFound)
- ensure
- bundler_gemfile.rmtree if @remove_bundler_gemfile
- end
- end
end
describe "when called twice" do
diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb
index 35cf8bfefb..ba7b362b5b 100644
--- a/spec/spec_helper.rb
+++ b/spec/spec_helper.rb
@@ -25,7 +25,6 @@ $debug = false
Spec::Manpages.setup unless Gem.win_platform?
Spec::Rubygems.setup
ENV["RUBYOPT"] = "#{ENV["RUBYOPT"]} -r#{Spec::Path.spec_dir}/support/hax.rb"
-ENV["BUNDLE_SPEC_RUN"] = "true"
# Don't wrap output in tests
ENV["THOR_COLUMNS"] = "10000"
diff --git a/spec/support/helpers.rb b/spec/support/helpers.rb
index 478fe60822..0567b26c01 100644
--- a/spec/support/helpers.rb
+++ b/spec/support/helpers.rb
@@ -313,6 +313,12 @@ module Spec
bundle :lock, opts
end
+ # Makes tests that require absence of any Gemfiles pass, even if the running
+ # system has a Gemfile further up from the specs folder
+ def ensure_no_gemfile
+ allow(Bundler::SharedHelpers).to receive(:search_up).and_return(nil)
+ end
+
def install_gems(*gems)
options = gems.last.is_a?(Hash) ? gems.pop : {}
gem_repo = options.fetch(:gem_repo) { gem_repo1 }