1 # run with: rspec spec/type/nova_aggregate_spec.rb
6 describe Puppet::Type.type(:nova_aggregate) do
8 @provider_class = described_class.provide(:simple) do
12 def exists?; get(:ensure) != :absent; end
14 def self.instances; []; end
18 it "should be able to create an instance" do
19 described_class.new(:name => 'agg0').should_not be_nil
22 it "should be able to create an more complex instance" do
23 described_class.new(:name => 'agg0',
24 :availability_zone => 'myzone',
25 :metadata => "a=b, c=d",
26 :hosts => "host1").should_not be_nil
29 it "should be able to create an more complex instance with multiple hosts" do
30 described_class.new(:name => 'agg0',
31 :availability_zone => 'myzone',
32 :metadata => "a=b, c=d",
33 :hosts => "host1, host2").should_not be_nil
36 it "should be able to create a instance and have the default values" do
37 c = described_class.new(:name => 'agg0')
38 c[:name].should == "agg0"
39 c[:availability_zone].should == nil
40 c[:metadata].should == nil
41 c[:hosts].should == nil
44 it "should return the given values" do
45 c = described_class.new(:name => 'agg0',
46 :availability_zone => 'myzone',
47 :metadata => " a = b , c= d ",
48 :hosts => " host1, host2 ")
49 c[:name].should == "agg0"
50 c[:availability_zone].should == "myzone"
51 c[:metadata].should == {"a" => "b", "c" => "d"}
52 c[:hosts].should == ["host1" , "host2"]
55 it "should return the given values" do
56 c = described_class.new(:name => 'agg0',
57 :availability_zone => "",
60 c[:name].should == "agg0"
61 c[:availability_zone].should == ""
62 c[:metadata].should == {}
63 c[:hosts].should == []