# Stubbing Paperclip calls to Amazon S3 (for Rspec)

**URL:** <https://www.ruby-forum.com/t/stubbing-paperclip-calls-to-amazon-s3-for-rspec/148868>\
**Category:** Rails\
**Created:** [September 17, 2008, 9:09pm UTC](https://www.ruby-forum.com/t/stubbing-paperclip-calls-to-amazon-s3-for-rspec/148868 "2008-09-17T21:09:58Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![chunkyslink](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/f0a364/32.png) [@chunkyslink](https://www.ruby-forum.com/u/chunkyslink)\
**Post date:** [September 17, 2008, 9:09pm UTC](https://www.ruby-forum.com/t/stubbing-paperclip-calls-to-amazon-s3-for-rspec/148868/1 "2008-09-17T21:09:58Z")

</div>

Would anyone happen to know how to stub a call to S3 from Paperclip?  
I’ve searched every where and no one seems to have posted anything about  
this. I’ve done very little in the way of spec’ing dependencies on  
external services, so any ideas on how to do this with Paperclip & S3  
would be most appreciated. I’m happy with stubbing out Thinking Sphinx -  
would Paperclip be much different to this (?);

```
def do_get
  ThinkingSphinx::Search.stub!(:search).and_return(users)
  get :index, :search => "bob"
end

```

Thanks

---

<div class="post-metadata">

**Author:** ![chunkyslink](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/f0a364/32.png) [@chunkyslink](https://www.ruby-forum.com/u/chunkyslink)\
**Post date:** [September 20, 2008, 2:53pm UTC](https://www.ruby-forum.com/t/stubbing-paperclip-calls-to-amazon-s3-for-rspec/148868/2 "2008-09-20T14:53:04Z")

</div>

Neil C. wrote:

> Would anyone happen to know how to stub a call to S3 from Paperclip?  
> I’ve searched every where and no one seems to have posted anything about  
> this. I’ve done very little in the way of spec’ing dependencies on  
> external services, so any ideas on how to do this with Paperclip & S3  
> would be most appreciated. I’m happy with stubbing out Thinking Sphinx -  
> would Paperclip be much different to this (?);
> 
> ```
> def do_get
> ThinkingSphinx::Search.stub!(:search).and_return(users)
> get :index, :search => "bob"
> end
> 
> ```
> 
> Thanks

If anyone can answer this I’ll draw them portrait with the pack of  
crayola crayons my Gran just bought me. You won’t believe how good I can  
make you look.
