Sha256: 20cfaba771a62b6c7d15685411eb8ca7df10152b4d5aa7eb5ac123379ed11c78

Contents?: true

Size: 1.87 KB

Versions: 24

Compression:

Stored size: 1.87 KB

Contents

require_relative '../../lib/chef/provisioning/vsphere_driver/vsphere_url.rb'

describe 'VsphereUrl' do
	expected_host='1.1.1.1'
	expected_port=1818
	expected_path='/path'

	let(:url) {URI("vsphere://#{expected_host}:#{expected_port}#{expected_path}")}

	it "has the vsphere scheme" do
		expect(url.scheme).to eq('vsphere')
	end
	it "has the expected host" do
		expect(url.host).to eq(expected_host)
	end
	it "has the expected port" do
		expect(url.port).to eq(expected_port)
	end
	it "has the expected path" do
		expect(url.path).to eq(expected_path)
	end
	it "has the the default ssl setting" do
		expect(url.use_ssl).to eq(true)
	end
	it "has the the default insecure setting" do
		expect(url.insecure).to eq(false)
	end

	context "when setting from a hash" do
		let(:url) { URI::VsphereUrl.from_config({
			:host => '2.2.2.2',
			:port => 2345,
			:path => "/hoooo",
			:use_ssl => false,
			:insecure => true
		}) }

		it "asigns the correct url" do
			expect(url.to_s).to eq('vsphere://2.2.2.2:2345/hoooo?use_ssl=false&insecure=true')
		end
	end
	context "when ssl is enabled" do
		it "retuns an ssl value of true" do
			url = URI("vsphere://#{expected_host}:#{expected_port}#{expected_path}?use_ssl=true")
			expect(url.use_ssl).to eq(true)
		end
	end
	context "when ssl is disabled" do
		it "retuns an ssl value of true" do
			url = URI("vsphere://#{expected_host}:#{expected_port}#{expected_path}?use_ssl=false")
			expect(url.use_ssl).to eq(false)
		end
	end
	context "when insecure is enabled" do
		it "retuns an insecure value of true" do
			url = URI("vsphere://#{expected_host}:#{expected_port}#{expected_path}?insecure=true")
			expect(url.insecure).to eq(true)
		end
	end
	context "when insecure is disabled" do
		it "retuns an insecure value of true" do
			url = URI("vsphere://#{expected_host}:#{expected_port}#{expected_path}?insecure=false")
			expect(url.insecure).to eq(false)
		end
	end
end

Version data entries

24 entries across 24 versions & 1 rubygems

Version Path
chef-provisioning-vsphere-0.8.3.dev.2 spec/unit_tests/VsphereUrl_spec.rb
chef-provisioning-vsphere-0.8.3.dev spec/unit_tests/VsphereUrl_spec.rb
chef-provisioning-vsphere-0.8.1 spec/unit_tests/VsphereUrl_spec.rb
chef-provisioning-vsphere-0.8.0 spec/unit_tests/VsphereUrl_spec.rb
chef-provisioning-vsphere-0.7.2 spec/unit_tests/VsphereUrl_spec.rb
chef-provisioning-vsphere-0.7.1 spec/unit_tests/VsphereUrl_spec.rb
chef-provisioning-vsphere-0.7.0 spec/unit_tests/VsphereUrl_spec.rb
chef-provisioning-vsphere-0.6.0 spec/unit_tests/VsphereUrl_spec.rb
chef-provisioning-vsphere-0.6.0.dev.1 spec/unit_tests/VsphereUrl_spec.rb
chef-provisioning-vsphere-0.5.8 spec/unit_tests/VsphereUrl_spec.rb
chef-provisioning-vsphere-0.5.7.dev6 spec/unit_tests/VsphereUrl_spec.rb
chef-provisioning-vsphere-0.5.7.dev5 spec/unit_tests/VsphereUrl_spec.rb
chef-provisioning-vsphere-0.5.7.dev4 spec/unit_tests/VsphereUrl_spec.rb
chef-provisioning-vsphere-0.5.7.dev3 spec/unit_tests/VsphereUrl_spec.rb
chef-provisioning-vsphere-0.5.7.dev2 spec/unit_tests/VsphereUrl_spec.rb
chef-provisioning-vsphere-0.5.7.dev1 spec/unit_tests/VsphereUrl_spec.rb
chef-provisioning-vsphere-0.5.7.dev spec/unit_tests/VsphereUrl_spec.rb
chef-provisioning-vsphere-0.5.7 spec/unit_tests/VsphereUrl_spec.rb
chef-provisioning-vsphere-0.5.6 spec/unit_tests/VsphereUrl_spec.rb
chef-provisioning-vsphere-0.5.5 spec/unit_tests/VsphereUrl_spec.rb