summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoradamedx <adamed@getchef.com>2014-10-08 21:15:22 -0700
committeradamedx <adamed@getchef.com>2014-10-09 10:52:31 -0700
commita048beaf9cc44433e85fc2f8f5ebdfcc908ba0da (patch)
tree7c3d3a28d583d4df6467cde146792497560ac8e5
parentf8a8a28573607ed43980affe82944a82322303f6 (diff)
downloadchef-a048beaf9cc44433e85fc2f8f5ebdfcc908ba0da.tar.gz
Add specs for Windows color default config
-rw-r--r--spec/unit/knife/core/ui_spec.rb28
1 files changed, 28 insertions, 0 deletions
diff --git a/spec/unit/knife/core/ui_spec.rb b/spec/unit/knife/core/ui_spec.rb
index 9044bc2f2f..ed1037ebd5 100644
--- a/spec/unit/knife/core/ui_spec.rb
+++ b/spec/unit/knife/core/ui_spec.rb
@@ -403,6 +403,34 @@ EOM
@ui.format_cookbook_list_for_display(@item).should == response
end
end
+
+ context "when running on Windows" do
+ before(:each) do
+ stdout = double('StringIO', :tty? => true)
+ @ui.stub(:stdout).and_return(stdout)
+ Chef::Platform.stub(:windows?) { true }
+ Chef::Config.reset
+ end
+
+ after(:each) do
+ Chef::Config.reset
+ end
+
+ it "should have color set to true if knife config has color explicitly set to true" do
+ Chef::Config[:color] = true
+ @ui.config[:color] = true
+ expect(@ui.color?).to eql(true)
+ end
+
+ it "should have color set to false if knife config has color explicitly set to false" do
+ Chef::Config[:color] = false
+ expect(@ui.color?).to eql(false)
+ end
+
+ it "should not have color set to false by default" do
+ expect(@ui.color?).to eql(false)
+ end
+ end
end
describe "confirm" do