summaryrefslogtreecommitdiff
path: root/spec/commands/console_spec.rb
diff options
context:
space:
mode:
authorFelix Bùˆnemann <buenemann@louis.info>2015-11-16 20:26:15 +0100
committerFelix Bùˆnemann <buenemann@louis.info>2015-11-16 20:26:15 +0100
commit95d21b224284739e0fd1bf936cc36688e669b377 (patch)
treead34d9bb0531446cf806c6ac5a6d8d627dd2489e /spec/commands/console_spec.rb
parentf787c664b4645fb44066b140b3b9afee542590c9 (diff)
downloadbundler-95d21b224284739e0fd1bf936cc36688e669b377.tar.gz
Fix bundle console specs
The previous specs only worked by accident, because the error message "Couldn't load pry\nCould not find constant IRB\n" contained both of the strings expected by the assertions. In order to test loading an alternate console without adding a permanent dependency, we can use a fake pry gem that implements the minimum required api.
Diffstat (limited to 'spec/commands/console_spec.rb')
-rw-r--r--spec/commands/console_spec.rb20
1 files changed, 16 insertions, 4 deletions
diff --git a/spec/commands/console_spec.rb b/spec/commands/console_spec.rb
index f26fbcdba5..4b1de42e8a 100644
--- a/spec/commands/console_spec.rb
+++ b/spec/commands/console_spec.rb
@@ -18,14 +18,26 @@ describe "bundle console" do
expect(out).to include("0.9.1")
end
+ it "uses IRB as default console" do
+ bundle "console" do |input|
+ input.puts("__method__")
+ input.puts("exit")
+ end
+ expect(out).to include(":irb_binding")
+ end
+
it "starts another REPL if configured as such" do
+ install_gemfile <<-G
+ source "file://#{gem_repo1}"
+ gem "pry"
+ G
bundle "config console pry"
bundle "console" do |input|
- input.puts("__callee__")
+ input.puts("__method__")
input.puts("exit")
end
- expect(out).to include("pry")
+ expect(out).to include(":__pry__")
end
it "falls back to IRB if the other REPL isn't available" do
@@ -33,10 +45,10 @@ describe "bundle console" do
# make sure pry isn't there
bundle "console" do |input|
- input.puts("__callee__")
+ input.puts("__method__")
input.puts("exit")
end
- expect(out).to include("IRB")
+ expect(out).to include(":irb_binding")
end
it "doesn't load any other groups" do