Sha256: d519d16a7291164b3cf67f7dbee039c8b4a3bb40834305d55056f2ac78e354b5

Contents?: true

Size: 974 Bytes

Versions: 5

Compression:

Stored size: 974 Bytes

Contents

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

Version data entries

5 entries across 5 versions & 1 rubygems

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