Sha256: 2ec37de75053afc7dbae652b0435e09e28b9c4fb4d899b93488e9bc2dbaaea96

Contents?: true

Size: 1.62 KB

Versions: 4

Compression:

Stored size: 1.62 KB

Contents

require_relative 'base'
require "vagrant-skytap/model/forwarded_port"

describe VagrantPlugins::Skytap::Model::ForwardedPort do
  include_context "unit"

  let(:fp1) { VagrantPlugins::Skytap::Model::ForwardedPort.new("tcp9000", 9000, 80, protocol: 'tcp') }
  let(:fp2) { VagrantPlugins::Skytap::Model::ForwardedPort.new("tcp80", 80, 80, protocol: 'tcp') }
  let(:fp3) { VagrantPlugins::Skytap::Model::ForwardedPort.new("tcp2222", 2222, 22, protocol: 'tcp') }
  let(:fp4) { VagrantPlugins::Skytap::Model::ForwardedPort.new("ssh", 2201, 22, protocol: 'tcp') }
  let(:fp5) { VagrantPlugins::Skytap::Model::ForwardedPort.new("tcp1024", 1024, 80, protocol: 'tcp') }
  let(:fp6) { VagrantPlugins::Skytap::Model::ForwardedPort.new("tcp9000", 80, 1025, protocol: 'tcp') }

  describe "privileged_host_port?" do
    it "returns false for host port above 1024" do
      expect(fp1.privileged_host_port?).to be false
    end

    it "returns true for host port below 1024" do
      expect(fp2.privileged_host_port?).to be true
    end

    it "returns true for host port 1024" do
      expect(fp5.privileged_host_port?).to be true
    end

    it "returns true for host port 80 if guest port is over 1024" do
      expect(fp6.privileged_host_port?).to be true
    end
  end

  describe "internal_ssh_port?" do
    it "returns false for typical host port" do
      expect(fp1.internal_ssh_port?).to be false
    end

    it "returns true when guest port is 22 and host port is 2222" do
      expect(fp3.internal_ssh_port?).to be true
    end

    it "returns true when id has special value 'ssh'" do
      expect(fp4.internal_ssh_port?).to be true
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
vagrant-skytap-0.2.3 spec/unit/forwarded_port_spec.rb
vagrant-skytap-0.2.2 spec/unit/forwarded_port_spec.rb
vagrant-skytap-0.2.1 spec/unit/forwarded_port_spec.rb
vagrant-skytap-0.2.0 spec/unit/forwarded_port_spec.rb