(spec) Add format spec test

This commit is contained in:
Brian Cain 2015-10-21 22:21:13 -07:00
parent ac12ea69c1
commit b62cffa2cd
3 changed files with 20 additions and 2 deletions

View file

@ -0,0 +1,18 @@
require 'spec_helper'
require 'json'
require_relative '../../lib/vmfloaty/format'
describe Pooler do
describe "#get_hosts" do
before :each do
@hostname_hash = "{\"ok\":true,\"debian-7-i386\":{\"hostname\":[\"sc0o4xqtodlul5w\",\"4m4dkhqiufnjmxy\"]},\"debian-7-x86_64\":{\"hostname\":\"zb91y9qbrbf6d3q\"},\"domain\":\"company.com\"}"
@format_hash = "{\"debian-7-i386\":[\"sc0o4xqtodlul5w\",\"4m4dkhqiufnjmxy\"],\"debian-7-x86_64\":\"zb91y9qbrbf6d3q\",\"domain\":\"company.com\"}"
end
it "formats a hostname hash into os, hostnames, and domain name" do
expect(Format.get_hosts(JSON.parse(@hostname_hash))).to eq @format_hash
end
end
end