diff options
author | Bundlerbot <bot@bundler.io> | 2019-03-06 01:51:33 +0000 |
---|---|---|
committer | Bundlerbot <bot@bundler.io> | 2019-03-06 01:51:33 +0000 |
commit | 264ef6be20cf5753660c32bcb2591b8a65325977 (patch) | |
tree | 401d21c01c7bcce61fab581e52dcb2f2412eb4c1 | |
parent | 4c817e5632e596c6c811ed31bb26af64c1f0195e (diff) | |
parent | e59c621c4529910b1e878f767396f4ee39802c38 (diff) | |
download | bundler-264ef6be20cf5753660c32bcb2591b8a65325977.tar.gz |
Merge #6994
6994: skip colorize examples when the environment was mswin or non tty. r=hsbt a=hsbt
### What was the end-user problem that led to this PR?
Fixes https://github.com/bundler/bundler/issues/6900
### What was your diagnosis of the problem?
The current bundler examples were not supported on mswin and non-tty environments.
### What is your fix for the problem, implemented in this PR?
I make to skip them when Thor detected unsupported environment.
### Why did you choose this fix out of the possible options?
Thor is vendoered now. It's easy to fix bundler's example directly.
Co-authored-by: SHIBATA Hiroshi <hsbt@ruby-lang.org>
-rw-r--r-- | spec/bundler/source_spec.rb | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/spec/bundler/source_spec.rb b/spec/bundler/source_spec.rb index 9ef8e7e50f..d70fd7e549 100644 --- a/spec/bundler/source_spec.rb +++ b/spec/bundler/source_spec.rb @@ -60,6 +60,10 @@ RSpec.describe Bundler::Source do before { Bundler.ui = Bundler::UI::Shell.new } it "should return a string with the spec name and version and locked spec version" do + if Bundler.ui.instance_variable_get(:@shell).is_a?(Bundler::Thor::Shell::Basic) + skip "tty color is not supported with Thor::Shell::Basic environment." + end + expect(subject.version_message(spec)).to eq("nokogiri >= 1.6\e[32m (was < 1.5)\e[0m") end end @@ -79,6 +83,10 @@ RSpec.describe Bundler::Source do before { Bundler.ui = Bundler::UI::Shell.new } it "should return a string with the locked spec version in yellow" do + if Bundler.ui.instance_variable_get(:@shell).is_a?(Bundler::Thor::Shell::Basic) + skip "tty color is not supported with Thor::Shell::Basic environment." + end + expect(subject.version_message(spec)).to eq("nokogiri 1.6.1\e[33m (was 1.7.0)\e[0m") end end @@ -92,6 +100,10 @@ RSpec.describe Bundler::Source do before { Bundler.ui = Bundler::UI::Shell.new } it "should return a string with the locked spec version in green" do + if Bundler.ui.instance_variable_get(:@shell).is_a?(Bundler::Thor::Shell::Basic) + skip "tty color is not supported with Thor::Shell::Basic environment." + end + expect(subject.version_message(spec)).to eq("nokogiri 1.7.1\e[32m (was 1.7.0)\e[0m") end end |