Created
September 3, 2008 06:56
-
-
Save foeken/8553 to your computer and use it in GitHub Desktop.
Simple Net::Http Mock
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
class Net::HTTP < Net::Protocol | |
def connect | |
end | |
end | |
class Net::HTTPResponse | |
def body=(content) | |
@body = content | |
@read = true | |
end | |
end | |
class Net::HTTP < Net::Protocol | |
mattr_accessor :xml_data | |
def post(path, body, headers) | |
raise "Broken mock" if !self.xml_data | |
res = Net::HTTPSuccess.new('1.2', '200', 'OK') | |
res.body = self.xml_data | |
return res | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment