summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordanielsdeleo <dan@opscode.com>2013-01-07 13:05:11 -0800
committerdanielsdeleo <dan@opscode.com>2013-01-07 13:05:11 -0800
commit8e7c28cb86889072e207ca8094340eff38d69f55 (patch)
treef3938882ea8fd0912d55bd1803df3dd7d693a85a
parentcc84f37951300ef6783a454165bdc5fae02ca5b0 (diff)
downloadchef-8e7c28cb86889072e207ca8094340eff38d69f55.tar.gz
Stub windows platform detection in spec tests
-rw-r--r--spec/unit/provider/file_spec.rb3
-rw-r--r--spec/unit/provider/template_spec.rb32
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