summaryrefslogtreecommitdiff
path: root/spec/commands/exec_spec.rb
diff options
context:
space:
mode:
Diffstat (limited to 'spec/commands/exec_spec.rb')
-rw-r--r--spec/commands/exec_spec.rb20
1 files changed, 19 insertions, 1 deletions
diff --git a/spec/commands/exec_spec.rb b/spec/commands/exec_spec.rb
index cc5989790e..c2e3b88fdd 100644
--- a/spec/commands/exec_spec.rb
+++ b/spec/commands/exec_spec.rb
@@ -589,7 +589,7 @@ RSpec.describe "bundle exec" do
it_behaves_like "it runs"
end
- context "when Bundler.setup fails" do
+ context "when Bundler.setup fails", :bundler => "< 2" do
before do
gemfile <<-G
gem 'rack', '2'
@@ -606,6 +606,24 @@ RSpec.describe "bundle exec" do
it_behaves_like "it runs"
end
+ context "when Bundler.setup fails", :bundler => "2" do
+ before do
+ gemfile <<-G
+ gem 'rack', '2'
+ G
+ ENV["BUNDLER_FORCE_TTY"] = "true"
+ end
+
+ let(:exit_code) { Bundler::GemNotFound.new.status_code }
+ let(:expected) { <<-EOS.strip }
+\e[31mCould not find gem 'rack (= 2)' in locally installed gems.
+The source contains 'rack' at: 0.9.1, 1.0.0\e[0m
+\e[33mRun `bundle install` to install missing gems.\e[0m
+ EOS
+
+ it_behaves_like "it runs"
+ end
+
context "when the executable exits non-zero via at_exit" do
let(:executable) { super() + "\n\nat_exit { $! ? raise($!) : exit(1) }" }
let(:exit_code) { 1 }