diff options
author | nimisha <nimisha.sharad@msystechnologies.com> | 2017-02-24 18:46:51 +0530 |
---|---|---|
committer | Bryan McLellan <btm@loftninjas.org> | 2017-09-05 20:09:30 -0400 |
commit | 24de354c67305563f677080c03b8892c4a9e0fb1 (patch) | |
tree | 9e3657586d78f843aa3e139ecccba9d67e72efaf /spec/unit/provider/remote_file | |
parent | 35f4cafac60770b59853d7e12b418f1971d234db (diff) | |
download | chef-24de354c67305563f677080c03b8892c4a9e0fb1.tar.gz |
Fixing specs
Signed-off-by: nimisha <nimisha.sharad@msystechnologies.com>
Diffstat (limited to 'spec/unit/provider/remote_file')
-rw-r--r-- | spec/unit/provider/remote_file/fetcher_spec.rb | 1 | ||||
-rw-r--r-- | spec/unit/provider/remote_file/network_file_spec.rb | 8 |
2 files changed, 5 insertions, 4 deletions
diff --git a/spec/unit/provider/remote_file/fetcher_spec.rb b/spec/unit/provider/remote_file/fetcher_spec.rb index 0fa213cdb2..f5b32800f2 100644 --- a/spec/unit/provider/remote_file/fetcher_spec.rb +++ b/spec/unit/provider/remote_file/fetcher_spec.rb @@ -27,6 +27,7 @@ describe Chef::Provider::RemoteFile::Fetcher do describe "when passed a network share" do before do expect(Chef::Provider::RemoteFile::NetworkFile).to receive(:new).and_return(fetcher_instance) + allow(Chef::Platform).to receive(:windows?).and_return(true) end context "when host is a name" do diff --git a/spec/unit/provider/remote_file/network_file_spec.rb b/spec/unit/provider/remote_file/network_file_spec.rb index 52743c0830..621d2769a4 100644 --- a/spec/unit/provider/remote_file/network_file_spec.rb +++ b/spec/unit/provider/remote_file/network_file_spec.rb @@ -20,10 +20,6 @@ require "spec_helper" describe Chef::Provider::RemoteFile::NetworkFile do - before do - allow(::Chef::Platform).to receive(:windows?).and_return(true) - end - let(:source) { "\\\\foohost\\fooshare\\Foo.tar.gz" } let(:new_resource) { Chef::Resource::RemoteFile.new("network file (new_resource)") } @@ -36,6 +32,10 @@ describe Chef::Provider::RemoteFile::NetworkFile do let(:chef_tempfile) { double("Chef::FileContentManagement::Tempfile", :tempfile => tempfile) } let(:source_file) { double("::File", :read => nil) } + before do + allow(fetcher).to receive(:node).and_return({ "platform_family" => "windows" }) + end + it "stages the local file to a temporary file" do expect(Chef::FileContentManagement::Tempfile).to receive(:new).with(new_resource).and_return(chef_tempfile) expect(::File).to receive(:open).with(source, "rb").and_return(source_file) |