2019-05-03 01:33:56 +03:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2019-03-10 01:35:36 +02:00
|
|
|
require 'rbconfig'
|
|
|
|
|
2018-11-22 17:37:22 +01:00
|
|
|
RSpec.describe 'Bundler' do
|
|
|
|
let(:ruby) { RbConfig.ruby.shellescape }
|
|
|
|
let(:pry_dir) { File.expand_path(File.join(__FILE__, '../../../lib')).shellescape }
|
|
|
|
|
|
|
|
context "when Pry requires Gemfile, which doesn't specify Pry as a dependency" do
|
|
|
|
it "loads auto-completion correctly" do
|
|
|
|
code = <<-RUBY
|
2020-06-16 19:35:43 +05:30
|
|
|
require "bundler"
|
2018-11-22 17:37:22 +01:00
|
|
|
require "bundler/inline"
|
2020-06-16 19:35:43 +05:30
|
|
|
require "pry"
|
2020-03-21 10:48:23 +08:00
|
|
|
|
|
|
|
# Silence the "The Gemfile specifies no dependencies" warning
|
|
|
|
class Bundler::UI::Shell
|
|
|
|
def warn(*args, &block); end
|
|
|
|
end
|
|
|
|
|
2018-11-22 17:37:22 +01:00
|
|
|
gemfile(true) do
|
|
|
|
source "https://rubygems.org"
|
|
|
|
end
|
|
|
|
exit 42 if Pry.config.completer
|
|
|
|
RUBY
|
|
|
|
`#{ruby} -I#{pry_dir} -e'#{code}'`
|
|
|
|
expect($CHILD_STATUS.exitstatus).to eq(42)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|