diff options
author | adamedx <adamed@getchef.com> | 2014-10-08 21:15:22 -0700 |
---|---|---|
committer | adamedx <adamed@getchef.com> | 2014-10-08 21:15:22 -0700 |
commit | 76e59429ae253d8f15da5c5735762376e4c92a29 (patch) | |
tree | 36b7698da989218b5118d8ca238a4ac0fc25821f | |
parent | 4c32c90ce50a54dec11cc42996dd0eb409e44afb (diff) | |
download | chef-adamedx/windows-knife-color.tar.gz |
Add specs for Windows color default configadamedx/windows-knife-color
-rw-r--r-- | spec/unit/knife/core/ui_spec.rb | 28 |
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 |