Sha256: 1e8d26d7bc74ef00992250a21b3df4f23e8cc4d8d8450b9b4902404ff6d9bf4d

Contents?: true

Size: 1.28 KB

Versions: 10

Compression:

Stored size: 1.28 KB

Contents

require File.dirname(__FILE__) + '/../../spec_helper'

include PoolParty::Resources

describe "Conditional" do
  before(:each) do
    reset_resources!
  end
  describe "wrapped" do
    before(:each) do
      @cloud = cloud :conditional_cloud_spec do
          execute_if("$hostname", "'master'", self) do
            has_file({:name => "/etc/apache2/puppetmaster2.conf"})
          end
      end
      @cond = @cloud.get_resource(:conditional, "$hostname == 'master'")
    end
    it "should add the block of resources on the parent" do
      @cloud.resources.size.should == 1
    end
    it "should have a conditional in the resources" do
      @cond.name.should == "$hostname == 'master'"
    end
    it "should push the resources onto the conditional resource" do
      @cond.resources.size.should == 1
    end
    it "should have a file resource on the conditional" do
      @cond.get_resource(:file, "/etc/apache2/puppetmaster2.conf").name.should == "/etc/apache2/puppetmaster2.conf"
    end
    it "should have the parent as the cloud" do
      @cond.parent.should == @cloud
    end
    describe "to_string" do
      before(:each) do
        @string = @cond.to_string
      end
      it "should have a case statement for the hostname" do
        @string.should =~ /case \$hostname/
      end
    end
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
auser-poolparty-0.2.20 spec/poolparty/pool/resources/conditional_spec.rb
auser-poolparty-0.2.21 spec/poolparty/pool/resources/conditional_spec.rb
auser-poolparty-0.2.22 spec/poolparty/pool/resources/conditional_spec.rb
auser-poolparty-0.2.23 spec/poolparty/pool/resources/conditional_spec.rb
auser-poolparty-0.2.24 spec/poolparty/pool/resources/conditional_spec.rb
auser-poolparty-0.2.25 spec/poolparty/pool/resources/conditional_spec.rb
auser-poolparty-0.2.26 spec/poolparty/pool/resources/conditional_spec.rb
auser-poolparty-0.2.35 spec/poolparty/pool/resources/conditional_spec.rb
auser-poolparty-0.2.36 spec/poolparty/pool/resources/conditional_spec.rb
auser-poolparty-0.2.37 spec/poolparty/pool/resources/conditional_spec.rb