CaptainDriftwood
CaptainDriftwood

Reputation: 5688

How to mock aws-sdk gem to store s3 uploads, sqs messages, sns messages

Is there a way to mock s3 bucket, sqs queues, and sns topics in the Ruby aws-sdk (similar to Moto in the Python sdk) to where assertions can be made on those uploaded objects and sent messages after the application code is run?

I know I am able to stub the response of the aws sdk so that no real requests are sent using the following code:

Aws.config[:stub_responses] = true

But that doesn't get me the ability to make assertions on uploaded s3 objects and sent sqs/sns messages.

Upvotes: 0

Views: 384

Answers (1)

user9367311
user9367311

Reputation:

All of the unit tests in the following folder use stubs for Amazon S3 for Ruby. Hope this helps you: https://github.com/awsdocs/aws-doc-sdk-examples/blob/master/ruby/example_code/s3/tests

You can extend this pattern for Amazon SQS and Amazon SNS as well. I hope to add some myself by the end of this year...

Upvotes: 1

Related Questions