aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'site/spec/support/http_stub.rb')
-rw-r--r--site/spec/support/http_stub.rb22
1 files changed, 22 insertions, 0 deletions
diff --git a/site/spec/support/http_stub.rb b/site/spec/support/http_stub.rb
new file mode 100644
index 0000000..ba6565e
--- /dev/null
+++ b/site/spec/support/http_stub.rb
@@ -0,0 +1,22 @@
+class ResponseStub
+ def initialize(filename)
+ @filename = filename
+ end
+ def body
+ path = File.expand_path(File.join(File.dirname(__FILE__), "../files", @filename))
+ File.open(path).read
+ end
+end
+
+class RespStub
+ def get(path)
+ filename = path.split('/').last
+ ResponseStub.new(filename)
+ end
+end
+
+class Net::HTTP
+ def self.start(serv)
+ yield(RespStub.new)
+ end
+end