Sha256: 34b3efff4e6af797af9778279769d30d22e3604c12015788ee9c618302acb80f

Contents?: true

Size: 524 Bytes

Versions: 14

Compression:

Stored size: 524 Bytes

Contents

require 'fakeweb'

module FakeJsonHelper

  def fake_json(expected, options = {})
    FakeWeb.register_uri(
      :post,
      Itunes.endpoint,
      options.merge(
        :body => File.read(File.join(File.dirname(__FILE__), '../fake_json', "#{expected}.json"))
      )
    )
  end

  def post_to(endpoint)
    raise_error(
      FakeWeb::NetConnectNotAllowedError,
      "Real HTTP connections are disabled. Unregistered request: POST #{endpoint}"
    )
  end

end

FakeWeb.allow_net_connect = false
include FakeJsonHelper

Version data entries

14 entries across 14 versions & 2 rubygems

Version Path
suhovius-itunes-receipt-1.1.1 spec/helpers/fake_json_helper.rb
itunes-receipt-1.1.0 spec/helpers/fake_json_helper.rb
itunes-receipt-1.0.0 spec/helpers/fake_json_helper.rb
itunes-receipt-0.1.5 spec/helpers/fake_json_helper.rb
itunes-receipt-0.1.4 spec/helpers/fake_json_helper.rb
itunes-receipt-0.1.3 spec/helpers/fake_json_helper.rb
itunes-receipt-0.1.2 spec/helpers/fake_json_helper.rb
itunes-receipt-0.1.1 spec/helpers/fake_json_helper.rb
itunes-receipt-0.1.0 spec/helpers/fake_json_helper.rb
itunes-receipt-0.0.5 spec/helpers/fake_json_helper.rb
itunes-receipt-0.0.4 spec/helpers/fake_json_helper.rb
itunes-receipt-0.0.3 spec/helpers/fake_json_helper.rb
itunes-receipt-0.0.2 spec/helpers/fake_json_helper.rb
itunes-receipt-0.0.1 spec/helpers/fake_json_helper.rb