diff options
author | Samuel Giddins <segiddins@segiddins.me> | 2017-02-07 14:04:39 -0600 |
---|---|---|
committer | Samuel Giddins <segiddins@segiddins.me> | 2017-02-07 18:21:27 -0600 |
commit | 5494ef4e236250b30ecd5592250224b93abac3e1 (patch) | |
tree | fa8fbb5a9d9616fb2d8aa2a9a766e1e69dd2174b | |
parent | c0de8f625f0ae2ed5cc2b26673c875e2900a9829 (diff) | |
download | bundler-seg-ensure-silent-shell-parity.tar.gz |
[UI::Silent] Ensure all the same methods as Shell are implementedseg-ensure-silent-shell-parity
-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 |