forked from pvo/ruby-cloudfiles
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix StorageObject#metadata for 1.9.2
In ruby 1.8.7, Array#to_s behaves like: >> ['a',1,'b',2].to_s => "a1b2" In ruby 1.9.2 however: >> ['a',1,'b',2].to_s => "["a", 1, "b", 2]" This means that StorageObject#metadata is returning mangled values for those headers. This fix should replicate the 1.8.7 behavior in 1.9.2. Tests are included and pass (for that specific test) in both 1.8.7 and 1.9.2
- Loading branch information
Showing
2 changed files
with
8 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -109,12 +109,12 @@ def test_set_metadata_fails | |
|
||
def test_read_metadata_succeeds | ||
connection = stub(:storagehost => 'test.storage.example', :storagepath => '/dummy/path', :storageport => 443, :storagescheme => 'https', :cdnmgmthost => 'cdm.test.example', :cdnmgmtpath => '/dummy/path', :cdnmgmtport => 443, :cdnmgmtscheme => 'https', :cdn_available? => true) | ||
response = {'x-container-bytes-used' => '42', 'x-container-object-count' => '5', 'x-object-meta-foo' => 'Bar', 'last-modified' => Time.now.to_s} | ||
response = {'x-container-bytes-used' => '42', 'x-container-object-count' => '5', 'x-object-meta-foo' => 'Bar', 'x-object-meta-spam' => ['peanut', 'butter'], 'last-modified' => Time.now.to_s} | ||
response.stubs(:code).returns('204') | ||
connection.stubs(:cfreq => response) | ||
container = CloudFiles::Container.new(connection, 'test_container') | ||
@object = CloudFiles::StorageObject.new(container, 'test_object') | ||
assert_equal @object.metadata, {'foo' => 'Bar'} | ||
assert_equal @object.metadata, {'foo' => 'Bar', 'spam' => 'peanutbutter'} | ||
This comment has been minimized.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong.
slyphon
via email
Author
Owner
|
||
end | ||
|
||
def test_write_succeeds | ||
|
I like peanut butter.