Post.create calls both the Cloudinary and Bitly API.
def create
...
if post_params[:image].present?
...
cl_resp = Cloudinary::Uploader.upload(params[:post][:image], auth)
end
bitly_url = "http://api.bitly.com/..."
resp = JSON.parse(Net::HTTP.get URI(bitly_url))
However, the Cloudinary spec only stubs the Cloudinary request raising an error about the Bitly request and vice versa. So even if the request are written correctly, the tests will fail.
This can be fixed by eagerly stubing both requests.
Post.create calls both the Cloudinary and Bitly API.
However, the Cloudinary spec only stubs the Cloudinary request raising an error about the Bitly request and vice versa. So even if the request are written correctly, the tests will fail.
This can be fixed by eagerly stubing both requests.