summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThe Bundler Bot <bot@bundler.io>2017-02-08 17:52:34 +0000
committerThe Bundler Bot <bot@bundler.io>2017-02-08 17:52:34 +0000
commitcad91be3c8f4ab5a71eee284c051cb2e7c2cb3a2 (patch)
tree42dd3628b93febff3a35997b1df10ad557b3977d
parent427f07f77f414f43d693c87c104546af3d9fe984 (diff)
parent5494ef4e236250b30ecd5592250224b93abac3e1 (diff)
downloadbundler-cad91be3c8f4ab5a71eee284c051cb2e7c2cb3a2.tar.gz
Auto merge of #5408 - bundler:seg-ensure-silent-shell-parity, r=segiddins
[UI::Silent] Ensure all the same methods as Shell are implemented Finish up the work of #5368
-rw-r--r--lib/bundler/ui/silent.rb10
-rw-r--r--spec/bundler/ui_spec.rb28
2 files changed, 38 insertions, 0 deletions
diff --git a/lib/bundler/ui/silent.rb b/lib/bundler/ui/silent.rb
index 61c7edd9b3..48390b7198 100644
--- a/lib/bundler/ui/silent.rb
+++ b/lib/bundler/ui/silent.rb
@@ -2,6 +2,8 @@
module Bundler
module UI
class Silent
+ attr_writer :shell
+
def initialize
@warnings = []
end
@@ -37,6 +39,14 @@ module Bundler
def ask(message)
end
+ def yes?(msg)
+ raise "Cannot ask yes? with a silent shell"
+ end
+
+ def no?
+ raise "Cannot ask no? with a silent shell"
+ end
+
def level=(name)
end
diff --git a/spec/bundler/ui_spec.rb b/spec/bundler/ui_spec.rb
new file mode 100644
index 0000000000..41c037527b
--- /dev/null
+++ b/spec/bundler/ui_spec.rb
@@ -0,0 +1,28 @@
+# frozen_string_literal: true
+require "spec_helper"
+
+RSpec.describe Bundler::UI do
+ describe Bundler::UI::Silent do
+ it "has the same instance methods as Shell", :ruby => ">= 1.9" do
+ shell = Bundler::UI::Shell
+ methods = proc do |cls|
+ cls.instance_methods.map do |i|
+ m = shell.instance_method(i)
+ [i, m.parameters]
+ end.sort_by(&:first)
+ end
+ expect(methods.call(described_class)).to eq(methods.call(shell))
+ end
+
+ it "has the same instance class as Shell", :ruby => ">= 1.9" do
+ shell = Bundler::UI::Shell
+ methods = proc do |cls|
+ cls.methods.map do |i|
+ m = shell.method(i)
+ [i, m.parameters]
+ end.sort_by(&:first)
+ end
+ expect(methods.call(described_class)).to eq(methods.call(shell))
+ end
+ end
+end