summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSamuel Giddins <segiddins@segiddins.me>2016-06-27 18:36:12 -0500
committerSamuel Giddins <segiddins@segiddins.me>2016-06-27 18:36:12 -0500
commit00aebf2320b72635e212c17c64bc84c58dce4a53 (patch)
tree8845b21e8dd1ab9f5b64024350de05b145f32062
parent58fc66897b156ce91eb98710f7708f8abe36c806 (diff)
downloadbundler-seg-specs-reset-ui.tar.gz
Fix spurious spec failures due to leaking Bundler.uiseg-specs-reset-ui
-rw-r--r--lib/bundler/ui/silent.rb1
-rw-r--r--spec/bundler/source_spec.rb14
-rw-r--r--spec/support/helpers.rb1
3 files changed, 14 insertions, 2 deletions
diff --git a/lib/bundler/ui/silent.rb b/lib/bundler/ui/silent.rb
index 02978fc686..19ff7311c0 100644
--- a/lib/bundler/ui/silent.rb
+++ b/lib/bundler/ui/silent.rb
@@ -3,6 +3,7 @@ module Bundler
module UI
class Silent
def add_color(string, color)
+ string
end
def info(message, newline = nil)
diff --git a/spec/bundler/source_spec.rb b/spec/bundler/source_spec.rb
index fc28220c7d..25abd90c96 100644
--- a/spec/bundler/source_spec.rb
+++ b/spec/bundler/source_spec.rb
@@ -57,8 +57,18 @@ describe Bundler::Source do
context "with a different version" do
let(:locked_gem) { double(:locked_gem, :name => "nokogiri", :version => "< 1.5") }
- it "should return a string with the spec name and version and locked spec version" do
- expect(subject.version_message(spec)).to eq("nokogiri >= 1.6 (\e[32mwas < 1.5\e[0m)")
+ context "with color" do
+ before { Bundler.ui = Bundler::UI::Shell.new }
+
+ it "should return a string with the spec name and version and locked spec version" do
+ expect(subject.version_message(spec)).to eq("nokogiri >= 1.6 (\e[32mwas < 1.5\e[0m)")
+ end
+ end
+
+ context "without color" do
+ it "should return a string with the spec name and version and locked spec version" do
+ expect(subject.version_message(spec)).to eq("nokogiri >= 1.6 (was < 1.5)")
+ end
end
end
end
diff --git a/spec/support/helpers.rb b/spec/support/helpers.rb
index 704e2140f5..d094727207 100644
--- a/spec/support/helpers.rb
+++ b/spec/support/helpers.rb
@@ -14,6 +14,7 @@ module Spec
FileUtils.mkdir_p(home)
ENV["BUNDLE_DISABLE_POSTIT"] = "1"
Bundler.send(:remove_instance_variable, :@settings) if Bundler.send(:instance_variable_defined?, :@settings)
+ Bundler.ui = nil
end
def self.bang(method)