diff options
-rw-r--r-- | lib/bundler/env.rb | 2 | ||||
-rw-r--r-- | spec/bundler/env_spec.rb | 8 |
2 files changed, 10 insertions, 0 deletions
diff --git a/lib/bundler/env.rb b/lib/bundler/env.rb index 8baf698dff..74541681ef 100644 --- a/lib/bundler/env.rb +++ b/lib/bundler/env.rb @@ -34,6 +34,8 @@ module Bundler end end + return out unless SharedHelpers.in_bundle? + if print_gemfile out << "\n#{Bundler.default_gemfile.relative_path_from(SharedHelpers.pwd)}\n\n" out << " " << read_file(Bundler.default_gemfile).gsub(/\n/, "\n ") << "\n" diff --git a/spec/bundler/env_spec.rb b/spec/bundler/env_spec.rb index 1be6cf46bc..245073d9b8 100644 --- a/spec/bundler/env_spec.rb +++ b/spec/bundler/env_spec.rb @@ -49,6 +49,14 @@ describe Bundler::Env do end end + context "when there no Gemfile and print_gemfile is true" do + let(:output) { env.report(:print_gemfile => true) } + + it "prints the environment" do + expect(output).to start_with("Environment") + end + end + context "when Gemfile contains a gemspec and print_gemspecs is true" do let(:gemspec) do <<-GEMSPEC.gsub(/^\s+/, "") |