このコードは、WebMockがなくても正常に機能します。
例外の発生:
Paperclip::AdapterRegistry::NoHandlerError:
No handler found for #<URI::HTTP:0x007ff3852cefb8 URL:http://www.example.com/images/foo.jpg>
# ./spec/support/api_mock.rb:34:in `process_image_for'
テスト:
let( :image_url ) { 'http://www.example.com/images/foo.jpg' }
...
stub_request(:post, image_url)
.to_return(:status => 200, :body => File.read('spec/fixtures/image.jpg'), :headers => {})
...hit Sinatra app...
api_mock.rb:
def self.process_image_for suggestion, params
if params[:image]
suggestion.image = URI.parse( params[:image] ) # line 34
suggestion.save!
end
end