Records submitted POST params
Records POST paths
Holds POST body responses
Override #request to fake its results
# File lib/rc_rest/net_http_stub.rb, line 54 def request(req) self.class.paths << req.path self.class.params << req.body response = self.class.responses.shift if response.respond_to? :call then response.call req else res = Net::HTTPResponse.new '1.0', 200, 'OK' res.body = response res end end
Override ::start to not connect
# File lib/rc_rest/net_http_stub.rb, line 45 def self.start(host, port) yield Net::HTTP.new(host) end