Created
December 26, 2014 16:00
-
-
Save dimroc/87dd394b82ed8273044f to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| module Stubs | |
| module S3 | |
| def s3_succeeds_to_get_fixture(fixture) | |
| WebMock.stub_request(:get, /https:\/\/s3\.amazonaws\.com\/test\.loopandtie\.com\/csv_imports\/.*#{fixture}/). | |
| with(:headers => {'Accept'=>'*/*', 'Accept-Encoding'=>''}). | |
| to_return(:status => 200, :body => fixture_url(fixture), :headers => {}) | |
| end | |
| def s3_succeeds_to_check_files | |
| WebMock.stub_request(:head, /https:\/\/s3\.amazonaws\.com\/test\.loopandtie\.com\/.*/). | |
| to_return(:status => 200, :body => "", :headers => {}) | |
| end | |
| def s3_succeeds_to_upload_files | |
| WebMock.stub_request(:put, /https:\/\/s3\.amazonaws\.com\/test\.loopandtie\.com\/.*/). | |
| with(:headers => {'Accept'=>'*/*'}). | |
| to_return(:status => 200, :body => "", :headers => {}) | |
| end | |
| end | |
| end | |
| RSpec.configure do |config| | |
| config.include Stubs::S3 | |
| end |
Author
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Stubbing S3 with WebMock to return a spec fixture.