diff options
author | danielsdeleo <dan@opscode.com> | 2013-01-04 15:29:58 -0800 |
---|---|---|
committer | danielsdeleo <dan@opscode.com> | 2013-01-04 15:29:58 -0800 |
commit | e0f3a2c5051256659ec0663517be791abaaa28ac (patch) | |
tree | f95fa001da2a472172ad3bee0c1317f693563d8e | |
parent | 73e81664850d1de453d7d0759b5d51d5a8a762ec (diff) | |
download | chef-e0f3a2c5051256659ec0663517be791abaaa28ac.tar.gz |
Fix remote file functional tests for ruby < 1.9.3
-rw-r--r-- | spec/functional/resource/remote_file_spec.rb | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/spec/functional/resource/remote_file_spec.rb b/spec/functional/resource/remote_file_spec.rb index 4a8b683f1b..57a5321ea2 100644 --- a/spec/functional/resource/remote_file_spec.rb +++ b/spec/functional/resource/remote_file_spec.rb @@ -46,9 +46,18 @@ describe Chef::Resource::RemoteFile do end let(:default_mode) do + # TODO: Lots of ugly here :( + # RemoteFile uses FileUtils.cp. FileUtils does a copy by opening the + # destination file and writing to it. Before 1.9.3, it does not preserve + # the mode of the copied file. In 1.9.3 and after, it does. So we have to + # figure out what the default mode ought to be via heuristic. + t = Tempfile.new("get-the-mode") - m = t.stat.mode + path = t.path + path_2 = t.path + "fileutils-mode-test" + FileUtils.cp(path, path_2) t.close + m = File.stat(path_2).mode (07777 & m).to_s(8) end |