Sha256: 379715c0e35cd85d574f6f931ae1c36818e02c3ac9230c64c0867ec094c5c513

Contents?: true

Size: 766 Bytes

Versions: 16

Compression:

Stored size: 766 Bytes

Contents

require 'rubygems'
gem 'rspec'
require 'spec'
require File.join(File.dirname(__FILE__), '..', 'lib', 'httparty')

def file_fixture(filename)
  open(File.join(File.dirname(__FILE__), 'fixtures', "#{filename.to_s}")).read
end

def stub_http_response_with(filename)
  format = filename.split('.').last.intern
  data = file_fixture(filename)
  http = Net::HTTP.new('localhost', 80)
  
  response = Net::HTTPOK.new("1.1", 200, "Content for you")
  response.stub!(:body).and_return(data)
  http.stub!(:request).and_return(response)
  
  http_request = HTTParty::Request.new(Net::HTTP::Get, '')
  http_request.stub!(:get_response).and_return(response)
  http_request.stub!(:format).and_return(format)
  
  HTTParty::Request.should_receive(:new).and_return(http_request)
end

Version data entries

16 entries across 16 versions & 4 rubygems

Version Path
alexvollmer-httparty-0.2.6 spec/spec_helper.rb
jnunemaker-httparty-0.2.0 spec/spec_helper.rb
jnunemaker-httparty-0.2.1 spec/spec_helper.rb
jnunemaker-httparty-0.2.2 spec/spec_helper.rb
jnunemaker-httparty-0.2.3 spec/spec_helper.rb
jnunemaker-httparty-0.2.4 spec/spec_helper.rb
jnunemaker-httparty-0.2.5 spec/spec_helper.rb
jnunemaker-httparty-0.2.6 spec/spec_helper.rb
juliocesar-httparty-0.2.6 spec/spec_helper.rb
httparty-0.2.0 spec/spec_helper.rb
httparty-0.2.1 spec/spec_helper.rb
httparty-0.2.2 spec/spec_helper.rb
httparty-0.2.3 spec/spec_helper.rb
httparty-0.2.4 spec/spec_helper.rb
httparty-0.2.6 spec/spec_helper.rb
httparty-0.2.5 spec/spec_helper.rb