Sha256: fb270b39bb4f9331b7e65cdc3de4aef56a9721e563c8bf931b335804567df1c6

Contents?: true

Size: 1.1 KB

Versions: 4

Compression:

Stored size: 1.1 KB

Contents

require 'spec_helper'

describe Invoker::Power::Balancer do
  context "matching domain part of incoming request" do
    before do
      @balancer = Invoker::Power::Balancer.new(mock("connection"), "http")
    end

    it "should do foo.dev match" do
      match = @balancer.extract_host_from_domain("foo.dev")
      expect(match).to_not be_nil

      matching_string = match[1]
      expect(matching_string).to eq("foo")
    end

    it "should match foo.dev:1080" do
      match = @balancer.extract_host_from_domain("foo.dev:1080")
      expect(match).to_not be_nil

      matching_string = match[1]
      expect(matching_string).to eq("foo")
    end

    it "should match emacs.bar.dev" do
      match = @balancer.extract_host_from_domain("emacs.bar.dev")
      expect(match).to_not be_nil

      matching_string = match[1]
      expect(matching_string).to eq("bar")
    end

    it "should match hello-world.dev" do
      match = @balancer.extract_host_from_domain("hello-world.dev")
      expect(match).to_not be_nil

      matching_string = match[1]
      expect(matching_string).to eq("hello-world")
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
invoker-1.2.0 spec/invoker/power/balancer_spec.rb
invoker-1.2.0.pre2 spec/invoker/power/balancer_spec.rb
invoker-1.2.0.pre1 spec/invoker/power/balancer_spec.rb
invoker-1.2.0.pre spec/invoker/power/balancer_spec.rb