diff options
author | The Bundler Bot <bot@bundler.io> | 2017-02-08 17:52:34 +0000 |
---|---|---|
committer | Samuel Giddins <segiddins@segiddins.me> | 2017-02-12 15:28:51 -0800 |
commit | 50db6d5f8dee76245fea31f527cd336d58afd189 (patch) | |
tree | f2622623ab03ff5ffa5178d8b8acdedc5cac2795 | |
parent | d924fe3ed3414f58403f2ef3842e46f39ddfde14 (diff) | |
download | bundler-50db6d5f8dee76245fea31f527cd336d58afd189.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
(cherry picked from commit cad91be3c8f4ab5a71eee284c051cb2e7c2cb3a2)
-rw-r--r-- | lib/bundler/ui/silent.rb | 10 | ||||
-rw-r--r-- | spec/bundler/ui_spec.rb | 28 |
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 |