Sha256: 128d0acd7c679e86da7a9c22d0012b3da0211907b134e369ef660fcf4e6c9089
Contents?: true
Size: 1.11 KB
Versions: 3
Compression:
Stored size: 1.11 KB
Contents
# Copyright (c) 2008 The Kaphan Foundation # # For licensing information see LICENSE. # # Please visit http://www.peerworks.org/contact for further information. # begin require 'spec' rescue LoadError require 'rubygems' gem 'rspec' require 'spec' end $:.unshift(File.join(File.dirname(__FILE__), '..', 'lib')) require 'atom' Spec::Runner.configure do |config| def mock_response(klass, body, headers = {}) response = klass.new(nil, nil, nil) response.stub!(:body).and_return(body) headers.each do |k, v| response.stub!(:[]).with(k).and_return(v) end response end def mock_http_get(url, response, user = nil, pass = nil) req = mock('request') Net::HTTP::Get.should_receive(:new).with(url.request_uri).and_return(req) if user && pass req.should_receive(:basic_auth).with(user, pass) end http = mock('http') http.should_receive(:request).with(req).and_return(response) http.stub!(:use_ssl=) http.stub!(:verify_mode=) http.stub!(:verify_depth=) Net::HTTP.should_receive(:new).with(url.host, url.port).and_return(http) end end
Version data entries
3 entries across 3 versions & 2 rubygems
Version | Path |
---|---|
ratom-0.6.10 | spec/spec_helper.rb |
ratom-instructure-0.6.9 | spec/spec_helper.rb |
ratom-0.6.9 | spec/spec_helper.rb |