Sha256: a7d52db4baa983f130ce386d6556401c31d91de87857564b798eafa7b662eccd

Contents?: true

Size: 939 Bytes

Versions: 13

Compression:

Stored size: 939 Bytes

Contents

require 'unit/spec_helper'

module Infrataster
  module Contexts
    describe HttpContext do
      context "with relative URI resource" do
        let(:address)  { '127.0.0.1' }
        let(:port)     { 80 }
        let(:resource) { Resources::HttpResource.new('/path/to/resource') }
        subject        { described_class.new(server, resource) }

        context "with http host definition" do
          let(:server) { Server.new('example.com', address, http: {:host => 'example.com'}) }

          it "complements host with server definition" do
            expect(subject.determine_host(address)).to eq('example.com')
          end
        end

        context "with no http host definition" do
          let(:server) { Server.new('example.com', address) }

          it "complements host with ip address" do
            expect(subject.determine_host(address)).to eq('127.0.0.1')
          end
        end
      end
    end
  end
end

Version data entries

13 entries across 13 versions & 1 rubygems

Version Path
infrataster-0.3.2 spec/unit/lib/infrataster/contexts/http_context_spec.rb
infrataster-0.3.1 spec/unit/lib/infrataster/contexts/http_context_spec.rb
infrataster-0.3.0 spec/unit/lib/infrataster/contexts/http_context_spec.rb
infrataster-0.2.6 spec/unit/lib/infrataster/contexts/http_context_spec.rb
infrataster-0.2.5 spec/unit/lib/infrataster/contexts/http_context_spec.rb
infrataster-0.2.4 spec/unit/lib/infrataster/contexts/http_context_spec.rb
infrataster-0.2.3 spec/unit/lib/infrataster/contexts/http_context_spec.rb
infrataster-0.2.2 spec/unit/lib/infrataster/contexts/http_context_spec.rb
infrataster-0.2.1 spec/unit/lib/infrataster/contexts/http_context_spec.rb
infrataster-0.2.0 spec/unit/lib/infrataster/contexts/http_context_spec.rb
infrataster-0.2.0.beta1 spec/unit/lib/infrataster/contexts/http_context_spec.rb
infrataster-0.1.13 spec/unit/lib/infrataster/contexts/http_context_spec.rb
infrataster-0.1.12 spec/unit/lib/infrataster/contexts/http_context_spec.rb