summaryrefslogtreecommitdiff
path: root/spec/integration/file_bucket/file_spec.rb
diff options
context:
space:
mode:
Diffstat (limited to 'spec/integration/file_bucket/file_spec.rb')
-rw-r--r--spec/integration/file_bucket/file_spec.rb21
1 files changed, 21 insertions, 0 deletions
diff --git a/spec/integration/file_bucket/file_spec.rb b/spec/integration/file_bucket/file_spec.rb
index 2c411fdf7..f0dbecaa3 100644
--- a/spec/integration/file_bucket/file_spec.rb
+++ b/spec/integration/file_bucket/file_spec.rb
@@ -41,4 +41,25 @@ describe Puppet::FileBucket::File do
end
end
end
+
+ describe "saving binary files" do
+ describe "on Ruby 1.8.7", :if => RUBY_VERSION.match(/^1\.8/) do
+ let(:binary) { "\xD1\xF2\r\n\x81NuSc\x00" }
+
+ it "does not error when the same contents are saved twice" do
+ bucket_file = Puppet::FileBucket::File.new(binary)
+ Puppet::FileBucket::File.indirection.save(bucket_file, bucket_file.name)
+ Puppet::FileBucket::File.indirection.save(bucket_file, bucket_file.name)
+ end
+ end
+ describe "on Ruby 1.9+", :if => RUBY_VERSION.match(/^1\.9|^2/) do
+ let(:binary) { "\xD1\xF2\r\n\x81NuSc\x00".force_encoding(Encoding::ASCII_8BIT) }
+
+ it "does not error when the same contents are saved twice" do
+ bucket_file = Puppet::FileBucket::File.new(binary)
+ Puppet::FileBucket::File.indirection.save(bucket_file, bucket_file.name)
+ Puppet::FileBucket::File.indirection.save(bucket_file, bucket_file.name)
+ end
+ end
+ end
end