Sha256: 1a38450bfb6cc49996c2fd3e1234e4c96ac665ea7e6feb2f67ea137324a72402

Contents?: true

Size: 1.13 KB

Versions: 10

Compression:

Stored size: 1.13 KB

Contents

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

include PoolParty::Resources

describe "Conditional" do
  before(:each) do
    @cloud = cloud :app do; end
    @cloud.instance_eval do
      execute_if("$hostname", "'master'", self) do
        file({:name => "/etc/apache2/puppetmaster.conf"})
      end
    end
    @cond = @cloud.resource(:conditional).first
  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
    @cloud.resource(:conditional).first.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.resource(:file).first.name.should == "/etc/apache2/puppetmaster.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

Version data entries

10 entries across 10 versions & 2 rubygems

Version Path
auser-poolparty-0.2.15 spec/poolparty/pool/resources/conditional_spec.rb
auser-poolparty-0.2.16 spec/poolparty/pool/resources/conditional_spec.rb
auser-poolparty-0.2.3 spec/poolparty/pool/resources/conditional_spec.rb
auser-poolparty-0.2.4 spec/poolparty/pool/resources/conditional_spec.rb
auser-poolparty-0.2.5 spec/poolparty/pool/resources/conditional_spec.rb
auser-poolparty-0.2.6 spec/poolparty/pool/resources/conditional_spec.rb
auser-poolparty-0.2.8 spec/poolparty/pool/resources/conditional_spec.rb
auser-poolparty-0.2.9 spec/poolparty/pool/resources/conditional_spec.rb
poolparty-0.2.18 spec/poolparty/pool/resources/conditional_spec.rb
poolparty-0.2.6 spec/poolparty/pool/resources/conditional_spec.rb