From 8e7c28cb86889072e207ca8094340eff38d69f55 Mon Sep 17 00:00:00 2001 From: danielsdeleo Date: Mon, 7 Jan 2013 13:05:11 -0800 Subject: Stub windows platform detection in spec tests --- spec/unit/provider/file_spec.rb | 3 +++ spec/unit/provider/template_spec.rb | 32 +++++++++++++++++++------------- 2 files changed, 22 insertions(+), 13 deletions(-) diff --git a/spec/unit/provider/file_spec.rb b/spec/unit/provider/file_spec.rb index 9dc3908bad..5b1cbbbdb8 100644 --- a/spec/unit/provider/file_spec.rb +++ b/spec/unit/provider/file_spec.rb @@ -54,6 +54,9 @@ describe Chef::Provider::File do end describe "examining file security metadata on Unix" do + before do + Chef::Platform.stub!(:windows?).and_return(false) + end it "should collect the current state of the file on the filesystem and populate current_resource" do # test setup stat_struct = mock("::File.stat", :mode => 0600, :uid => 0, :gid => 0, :mtime => 10000) diff --git a/spec/unit/provider/template_spec.rb b/spec/unit/provider/template_spec.rb index 5f59f8d50e..b709d8e612 100644 --- a/spec/unit/provider/template_spec.rb +++ b/spec/unit/provider/template_spec.rb @@ -117,19 +117,25 @@ describe Chef::Provider::Template do end context "and no access control settings are set on the resource" do - it "sets access control metadata on the new resource" do - @access_controls.stub!(:requires_changes?).and_return(false) - @access_controls.should_receive(:set_all!) - @node.normal[:slappiness] = "happiness" - @provider.should_receive(:backup) - @provider.run_action(:create) - IO.read(@rendered_file_location).should == "slappiness is happiness" - @resource.should be_updated_by_last_action - - # Veracity of actual data checked in functional tests - @resource.owner.should be_a_kind_of(String) - @resource.group.should be_a_kind_of(String) - @resource.mode.should be_a_kind_of(String) + context "on a Unix system" do + before do + Chef::Platform.stub!(:windows?).and_return(false) + end + + it "sets access control metadata on the new resource" do + @access_controls.stub!(:requires_changes?).and_return(false) + @access_controls.should_receive(:set_all!) + @node.normal[:slappiness] = "happiness" + @provider.should_receive(:backup) + @provider.run_action(:create) + IO.read(@rendered_file_location).should == "slappiness is happiness" + @resource.should be_updated_by_last_action + + # Veracity of actual data checked in functional tests + @resource.owner.should be_a_kind_of(String) + @resource.group.should be_a_kind_of(String) + @resource.mode.should be_a_kind_of(String) + end end end end -- cgit v1.2.1