Sha256: 6e3938110abd7c8df15f3bfd2fd2a6d0b978bc13063a1d2c4124e723a7fd89e0

Contents?: true

Size: 1.03 KB

Versions: 10

Compression:

Stored size: 1.03 KB

Contents

# Copyright (c) 2008 The Kaphan Foundation
#
# For licensing information see LICENSE.txt.
#
# 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)
    Net::HTTP.should_receive(:start).with(url.host, url.port).and_yield(http)
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
ratom-0.6.4 spec/spec_helper.rb
ratom-0.6.3 spec/spec_helper.rb
ratom-0.6.2 spec/spec_helper.rb
ratom-0.4.1 spec/spec_helper.rb
ratom-0.5.0 spec/spec_helper.rb
ratom-0.4.2 spec/spec_helper.rb
ratom-0.6.0 spec/spec_helper.rb
ratom-0.5.2 spec/spec_helper.rb
ratom-0.6.1 spec/spec_helper.rb
ratom-0.5.1 spec/spec_helper.rb