Sha256: 68202da4cb9998edaa27b07249b6152bcda52b044e90025e49c3cde8fa403f48

Contents?: true

Size: 633 Bytes

Versions: 2

Compression:

Stored size: 633 Bytes

Contents

module WebMockHelper
  def load_response(resource)
    File.read(File.join(File.dirname(__FILE__), '/../responses', "#{resource}.xml.response"))
  end

  def url_for_resource(resource)
    "#{LetsFreckle::Entry.base_api_url}#{LetsFreckle::Entry.relative_path_for(resource)}"
  end

  def stub_api_request(resource)
    stub_http_request(:get, url_for_resource(resource)).
        with(:headers => { 'Accept'         =>'*/*',
                           'Accept-Encoding'=>'gzip;q=1.0,deflate;q=0.6,identity;q=0.3',
                           'User-Agent'     =>'Ruby' }).
        to_return(:body => load_response(resource))
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
letsfreckle-client-0.2.1 spec/support/webmock_helper.rb
letsfreckle-client-0.2.0 spec/support/webmock_helper.rb