Sha256: 7ecad5475d3ca2b9911ab29e91052af01fe2ab1adf1fb69882829c0c5b03f21d

Contents?: true

Size: 684 Bytes

Versions: 7

Compression:

Stored size: 684 Bytes

Contents

require 'rubygems'
gem 'rspec', '>= 1.2.8'
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)

  response = Net::HTTPOK.new("1.1", 200, "Content for you")
  response.stub!(:body).and_return(data)

  http_request = HTTParty::Request.new(Net::HTTP::Get, 'http://localhost', :format => format)
  http_request.stub!(:perform_actual_request).and_return(response)

  HTTParty::Request.should_receive(:new).and_return(http_request)
end

Version data entries

7 entries across 7 versions & 7 rubygems

Version Path
dbalatero-httparty-0.4.4 spec/spec_helper.rb
geetarista-httparty-0.4.5 spec/spec_helper.rb
jnunemaker-httparty-0.4.4 spec/spec_helper.rb
nullstyle-httparty-0.4.4 spec/spec_helper.rb
kerryb-httparty-0.4.4 spec/spec_helper.rb
yyyc514-httparty-0.4.4.2 spec/spec_helper.rb
httparty-0.4.4 spec/spec_helper.rb