summaryrefslogtreecommitdiff
path: root/spec/integration/bundler_spec.rb
blob: 2c4f2b27abc70baaf3a841b47de844e2f7e72f99 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
# frozen_string_literal: true

require 'rbconfig'

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"

      # Silence the "The Gemfile specifies no dependencies" warning
      class Bundler::UI::Shell
        def warn(*args, &block); end
      end

      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