summaryrefslogtreecommitdiff
path: root/spec/functional/file_content_management
diff options
context:
space:
mode:
authordanielsdeleo <dan@opscode.com>2013-06-07 09:43:39 -0700
committerdanielsdeleo <dan@opscode.com>2013-06-07 09:43:39 -0700
commit288c55f91b6f4eb5a1bd474dbaa3fffeb644f9b9 (patch)
treec16a6afc87185a4d625a4b390ea63bd4f8b8bb0c /spec/functional/file_content_management
parentd6f6533a2fd674bde77d74c76c599b1457070a9a (diff)
downloadchef-288c55f91b6f4eb5a1bd474dbaa3fffeb644f9b9.tar.gz
Add ruby 1.8 fallbacks for IO.binread
Diffstat (limited to 'spec/functional/file_content_management')
-rw-r--r--spec/functional/file_content_management/deploy_strategies_spec.rb11
1 files changed, 10 insertions, 1 deletions
diff --git a/spec/functional/file_content_management/deploy_strategies_spec.rb b/spec/functional/file_content_management/deploy_strategies_spec.rb
index 846f116867..0c58677ba5 100644
--- a/spec/functional/file_content_management/deploy_strategies_spec.rb
+++ b/spec/functional/file_content_management/deploy_strategies_spec.rb
@@ -20,6 +20,15 @@ require 'spec_helper'
shared_examples_for "a content deploy strategy" do
+ # Ruby 1.8 has no binread
+ def binread(file)
+ if IO.respond_to?(:binread)
+ IO.binread(file)
+ else
+ IO.read(file)
+ end
+ end
+
def normalize_mode(mode_int)
( mode_int & 07777).to_s(8)
end
@@ -146,7 +155,7 @@ shared_examples_for "a content deploy strategy" do
it "updates the target with content from staged" do
content_deployer.deploy(staging_file_path, target_file_path)
- IO.binread(target_file_path).should == staging_file_content
+ binread(target_file_path).should == staging_file_content
end
context "when the owner of the target file is not the owner of the staging file", :requires_root do