kjvarga/sitemap_generator — pull request #130 by dncrht (2013-11-09 12:47:33+00:00)
Title: Changed S3 write implementation to a single call

Hi there,

I had trouble using the S3 adapter. It seemed that the `directory.get` call received a 403, however the user had all the permissions.

I found that it’s recommended to write the file in a single operation, without getting the directory first. See:

- https://github.com/fog/fog/issues/291
- http://stackoverflow.com/questions/12288125/how-to-create-an-s3-object-in-a-bucket-with-one-fog-call

So I’ve changed the implementation accordingly, and now works great.

I’ve written a test for it, as there wasn’t any tests for this adapter. The test ensures that this implementation details are kept. If you run the test with the previous implementation will fail.
I’m aware that this might not very “black box testing” with all those stub chains, but I think it’s the only way to go since the new implementation details are important.

Furthermore, I had to add the fog gem. I don’t know if the versions bound in `Gemfile.lock` are too recent or restrictive for other users, although it’s only in testing mode.

Thanks!