mirror of
https://github.com/fog/fog-aws.git
synced 2022-11-09 13:50:52 -05:00
Rewind pointer if file is eof on put_object mock
This commit is contained in:
parent
c150c9a19e
commit
5c13a5df99
2 changed files with 8 additions and 0 deletions
|
@ -15,6 +15,7 @@ module Fog
|
|||
def parse_mock_data(data)
|
||||
data = Fog::Storage.parse_data(data)
|
||||
unless data[:body].is_a?(String)
|
||||
data[:body].rewind if data[:body].eof?
|
||||
data[:body] = data[:body].read
|
||||
end
|
||||
data
|
||||
|
|
|
@ -18,6 +18,13 @@ Shindo.tests('AWS::Storage | object requests', ['aws']) do
|
|||
Fog::Storage[:aws].put_object(@directory.identity, 'fog_object', lorem_file)
|
||||
end
|
||||
|
||||
tests("#put_object('#{@directory.identity}', 'fog_object', lorem_file at EOF)").returns(lorem_file.read) do
|
||||
file = lorem_file
|
||||
file.read
|
||||
Fog::Storage[:aws].put_object(@directory.identity, 'fog_object', file)
|
||||
Fog::Storage[:aws].get_object(@directory.identity, 'fog_object').body
|
||||
end
|
||||
|
||||
tests("#copy_object('#{@directory.identity}', 'fog_object', '#{@directory.identity}', 'fog_other_object')").succeeds do
|
||||
Fog::Storage[:aws].copy_object(@directory.identity, 'fog_object', @directory.identity, 'fog_other_object')
|
||||
end
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue