diff options
author | Hiroshi SHIBATA <hsbt@ruby-lang.org> | 2020-12-08 16:36:29 +0900 |
---|---|---|
committer | Hiroshi SHIBATA <hsbt@ruby-lang.org> | 2020-12-08 17:30:02 +0900 |
commit | 473f9d2df0ddd7fdb5cc73fa3ad49b2f19f22b06 (patch) | |
tree | 6b39312502d32474da0157f5d55620fabd6454ea /spec/bundler/commands/console_spec.rb | |
parent | 4aca77edde91f826aa243e268bf1ef5214530583 (diff) |
Merge prepare version of Bundler 2.2.0
Notes
Notes:
Merged: https://github.com/ruby/ruby/pull/3864
Diffstat (limited to 'spec/bundler/commands/console_spec.rb')
-rw-r--r-- | spec/bundler/commands/console_spec.rb | 41 |
1 files changed, 38 insertions, 3 deletions
diff --git a/spec/bundler/commands/console_spec.rb b/spec/bundler/commands/console_spec.rb index 3092184f45..6f1e96261e 100644 --- a/spec/bundler/commands/console_spec.rb +++ b/spec/bundler/commands/console_spec.rb @@ -2,8 +2,43 @@ RSpec.describe "bundle console", :bundler => "< 3", :readline => true do before :each do + build_repo2 do + # A minimal fake pry console + build_gem "pry" do |s| + s.write "lib/pry.rb", <<-RUBY + class Pry + class << self + def toplevel_binding + unless defined?(@toplevel_binding) && @toplevel_binding + TOPLEVEL_BINDING.eval %{ + def self.__pry__; binding; end + Pry.instance_variable_set(:@toplevel_binding, __pry__) + class << self; undef __pry__; end + } + end + @toplevel_binding.eval('private') + @toplevel_binding + end + + def __pry__ + while line = gets + begin + puts eval(line, toplevel_binding).inspect.sub(/^"(.*)"$/, '=> \\1') + rescue Exception => e + puts "\#{e.class}: \#{e.message}" + puts e.backtrace.first + end + end + end + alias start __pry__ + end + end + RUBY + end + end + install_gemfile <<-G - source "#{file_uri_for(gem_repo1)}" + source "#{file_uri_for(gem_repo2)}" gem "rack" gem "activesupport", :group => :test gem "rack_middleware", :group => :development @@ -28,7 +63,7 @@ RSpec.describe "bundle console", :bundler => "< 3", :readline => true do it "starts another REPL if configured as such" do install_gemfile <<-G - source "#{file_uri_for(gem_repo1)}" + source "#{file_uri_for(gem_repo2)}" gem "pry" G bundle "config set console pry" @@ -87,7 +122,7 @@ RSpec.describe "bundle console", :bundler => "< 3", :readline => true do it "performs an automatic bundle install" do gemfile <<-G - source "#{file_uri_for(gem_repo1)}" + source "#{file_uri_for(gem_repo2)}" gem "rack" gem "activesupport", :group => :test gem "rack_middleware", :group => :development |