Sha256: ec33e2ad9711e778d80af70584dc21fcb819c0a76ed4ebcf7c2db9a232b2111f

Contents?: true

Size: 1.83 KB

Versions: 68

Compression:

Stored size: 1.83 KB

Contents

require_relative '../../lib/chef_metal_vsphere/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

68 entries across 68 versions & 1 rubygems

Version Path
clc-chef-metal-vsphere-0.3.67 spec/unit_tests/VsphereUrl_spec.rb
clc-chef-metal-vsphere-0.3.66 spec/unit_tests/VsphereUrl_spec.rb
clc-chef-metal-vsphere-0.3.65 spec/unit_tests/VsphereUrl_spec.rb
clc-chef-metal-vsphere-0.3.64 spec/unit_tests/VsphereUrl_spec.rb
clc-chef-metal-vsphere-0.3.63 spec/unit_tests/VsphereUrl_spec.rb
clc-chef-metal-vsphere-0.3.62 spec/unit_tests/VsphereUrl_spec.rb
clc-chef-metal-vsphere-0.3.61 spec/unit_tests/VsphereUrl_spec.rb
clc-chef-metal-vsphere-0.3.60 spec/unit_tests/VsphereUrl_spec.rb
clc-chef-metal-vsphere-0.3.59 spec/unit_tests/VsphereUrl_spec.rb
clc-chef-metal-vsphere-0.3.58 spec/unit_tests/VsphereUrl_spec.rb
clc-chef-metal-vsphere-0.3.57 spec/unit_tests/VsphereUrl_spec.rb
clc-chef-metal-vsphere-0.3.56 spec/unit_tests/VsphereUrl_spec.rb
clc-chef-metal-vsphere-0.3.55 spec/unit_tests/VsphereUrl_spec.rb
clc-chef-metal-vsphere-0.3.54 spec/unit_tests/VsphereUrl_spec.rb
clc-chef-metal-vsphere-0.3.53 spec/unit_tests/VsphereUrl_spec.rb
clc-chef-metal-vsphere-0.3.52 spec/unit_tests/VsphereUrl_spec.rb
clc-chef-metal-vsphere-0.3.51 spec/unit_tests/VsphereUrl_spec.rb
clc-chef-metal-vsphere-0.3.50 spec/unit_tests/VsphereUrl_spec.rb
clc-chef-metal-vsphere-0.3.49 spec/unit_tests/VsphereUrl_spec.rb
clc-chef-metal-vsphere-0.3.48 spec/unit_tests/VsphereUrl_spec.rb