mirror of
https://github.com/pry/pry.git
synced 2022-11-09 12:35:05 -05:00
85850f47e0
* Prevent Bundler from raising a LoadError when accessing input completions. The scenario: - $ mkdir foogem - $ cd foogem - $ echo "source 'https://rubygems.org'" > Gemfile - $ bundle install - $ pry -rbundler/setup - type "foo".<tab> into Pry Notice that a LoadError is raised when trying to require "pry/input_completer". This happens because Pry is not in the Gemfile, so once the sandbox is initialized by Bundler any require for a Pry file is doomed to file. Couple that with the fact that '_pry_.config.completer' is not loaded until a user uses tab completion, and we end up with this broken situation.
19 lines
586 B
Ruby
19 lines
586 B
Ruby
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
|
|
require "pry"
|
|
require "bundler/inline"
|
|
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
|