From a0b0016bcd470f798741fc071d9af1fd761bd188 Mon Sep 17 00:00:00 2001 From: Brian Cain Date: Sun, 15 Nov 2015 14:35:25 -0800 Subject: [PATCH] Add spec test for formatting hashes --- spec/vmfloaty/utils_spec.rb | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/spec/vmfloaty/utils_spec.rb b/spec/vmfloaty/utils_spec.rb index 8a31307..8ed6a90 100644 --- a/spec/vmfloaty/utils_spec.rb +++ b/spec/vmfloaty/utils_spec.rb @@ -15,4 +15,20 @@ describe Utils do expect(Utils.format_hosts(JSON.parse(@hostname_hash))).to eq @format_hash end end + + describe "#generate_os_hash" do + before :each do + @host_hash = {"centos"=>1, "debian"=>5, "windows"=>1} + end + + it "takes an array of os arguments and returns a formatted hash" do + host_arg = ["centos", "debian=5", "windows=1"] + expect(Utils.generate_os_hash(host_arg)).to eq @host_hash + end + + it "returns an empty hash if there are no arguments provided" do + host_arg = [] + expect(Utils.generate_os_hash(host_arg)).to be_empty + end + end end