mirror of
https://github.com/fog/fog.git
synced 2022-11-09 13:51:43 -05:00
[aws|simpledb] put_attributes: fix to handle array values for attributes.
Fixes Issue #67: https://github.com/geemus/fog/issues/#issue/67
This commit is contained in:
parent
6d7f859c34
commit
5b066998bb
2 changed files with 13 additions and 2 deletions
|
@ -54,9 +54,9 @@ module Fog
|
|||
@data[:domains][domain_name][item_name] ||= {}
|
||||
@data[:domains][domain_name][item_name][key.to_s] = [] unless @data[:domains][domain_name][item_name][key.to_s]
|
||||
if options[:replace].include?(key.to_s)
|
||||
@data[:domains][domain_name][item_name][key.to_s] = [value.to_s]
|
||||
@data[:domains][domain_name][item_name][key.to_s] = [*value].map {|x| x.to_s}
|
||||
else
|
||||
@data[:domains][domain_name][item_name][key.to_s] += [value.to_s]
|
||||
@data[:domains][domain_name][item_name][key.to_s] += [*value].map {|x| x.to_s}
|
||||
end
|
||||
end
|
||||
response.status = 200
|
||||
|
|
|
@ -36,6 +36,17 @@ describe 'SimpleDB.get_attributes' do
|
|||
end
|
||||
end
|
||||
|
||||
context "foo item is put with bar attribute as an array" do
|
||||
it "should return the array for foo's bar attribute" do
|
||||
the_array = %w{A B C}
|
||||
AWS[:sdb].put_attributes(@domain_name, 'foo', { :bar => the_array })
|
||||
eventually do
|
||||
actual = AWS[:sdb].get_attributes(@domain_name, 'foo')
|
||||
actual.body['Attributes']['bar'].should =~ the_array
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
describe 'failure' do
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue