Skip to content
This repository has been archived by the owner on Nov 20, 2018. It is now read-only.

How to stub content-length of S3 object? #220

Closed
hasanen opened this issue May 21, 2015 · 1 comment
Closed

How to stub content-length of S3 object? #220

hasanen opened this issue May 21, 2015 · 1 comment

Comments

@hasanen
Copy link

hasanen commented May 21, 2015

I want to test that my code fetch the actual size of file from S3, but can't get stubbing right.

I'm trying to stub get_object like this

client = Aws::S3::Client.new(stub_responses: true)
client.stub_responses(:get_object, { content_length: 1024 })
puts client.get_object(bucket: 'bucket', key: 'key').content_length

but I just get empty line in to console. What I'm missing here? I also tested examples of stubbing errors from https://docs.aws.amazon.com/sdkforruby/api/Aws/ClientStubs.html and those works like expected/documented.

@trevorrowe
Copy link
Contributor

Thank you for reporting the issue. I've been able to reproduce this and I have a temporary fix that I will be applying. This will ship with the next patch release of the SDK. I've also opened a new issue here against the master repo:

aws/aws-sdk-ruby#823

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants