Sha256: f1936008fdc8785f5700bc4036807113777cd523b539f619d08b2822c0425889

Contents?: true

Size: 852 Bytes

Versions: 5

Compression:

Stored size: 852 Bytes

Contents

require 'webmock'
include WebMock::API

module Rack
  module Test
    DEFAULT_HOST = 'sinatra.restpack-sample.org'
  end
end

module RestPack
  module Web
    class TestSupport
      def self.stub_restpack_web
        host = "http://:#{ENV['RESTPACK_ACCESS_KEY']}@#{ENV['RESTPACK_CORE_SERVICE']}/api/v1"
        stub_request(:get, "#{host}/configurations/root.json").to_return(:body => read_fixture('configurations_root'))
        stub_request(:get, "#{host}/domains/search.json?host=sinatra.restpack-sample.org").to_return(:body => read_fixture('domains_search'))
        stub_request(:get, "#{host}/channels/1.json").to_return(:body => read_fixture('channels'))
      end

      def self.read_fixture(name)
        file = File.open("#{File.expand_path('../../../spec/fixtures', __FILE__)}/#{name}.json")
        file.read
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
restpack_web-0.2.21 lib/restpack_web/test_support.rb
restpack_web-0.2.20 lib/restpack_web/test_support.rb
restpack_web-0.2.19 lib/restpack_web/test_support.rb
restpack_web-0.2.18 lib/restpack_web/test_support.rb
restpack_web-0.2.17 lib/restpack_web/test_support.rb