require_relative '../spec_helper' require 'net/http' require 'restpack_web/test_support' describe RestPack::Web::TestSupport do let(:configurations_root_path){ File.expand_path('./spec/fixtures/configurations_root.json') } let(:domains_search_path){ File.expand_path('./spec/fixtures/domains_search.json') } let(:channels_path){ File.expand_path('./spec/fixtures/channels.json') } describe '#stub_restpack_web' do before do RestPack::Web::TestSupport.stub_restpack_web end it 'stub all requests to the core service' do host = "http://:#{ENV['RESTPACK_ACCESS_KEY']}@#{ENV['RESTPACK_CORE_SERVICE']}/api/v1" RestClient.get("#{host}/configurations/root.json").must_equal File.read(configurations_root_path) RestClient.get("#{host}/domains/search.json?host=sinatra.restpack-sample.org").must_equal File.read(domains_search_path) RestClient.get("#{host}/channels/1.json").must_equal File.read(channels_path) end end end