Stubbing with Faraday and Rspec
问题 I have a model that looks like this: class Gist def self.create(options) post_response = Faraday.post do |request| request.url 'https://api.github.com/gists' request.headers['Authorization'] = "Basic " + Base64.encode64("#{GITHUB_USERNAME}:#{GITHUB_PASSWORD}") request.body = options.to_json end end end and a test that looks like this: require 'spec_helper' describe Gist do context '.create' do it 'POSTs a new Gist to the user\'s account' do Faraday.should_receive(:post) Gist.create({:public =