Sha256: fa299095865f6425de5781679a6eaaa7e28d763b29c2f44666ce266efe047315

Contents?: true

Size: 926 Bytes

Versions: 17

Compression:

Stored size: 926 Bytes

Contents

require "#{File.dirname(__FILE__)}/../../../test_helper"

include_fixture_resources

class ConditionalResourceTest < Test::Unit::TestCase
    
  def test_have_the_cron_method_denoted_by_has_method_name
    PoolParty::Resource.define_resource_methods
    @res = PoolParty::Resources::Conditional.new "os" do
      when_is :ubuntu, "git-core"
      else_is "git"
    end
    @base = DependencyResolvers::Chef
    @base.compile_directory = test_dir
    
    str = 'case "os"
when :ubuntu
  "git-core"
else
  "git"
end'

    assert_equal str, @base.compile(@res)
  end
  
  def test_compile_from_cloud
    pool "conditional_cloud" do
      cloud "test" do
        
        has_case "os" do
          when_is :ubuntu, "git-core"
          else_is "git"
        end
        
      end
    end
    
    str = 'case "os"
when :ubuntu
  "git-core"
else
  "git"
end'

    assert_equal str, clouds["test"].compile.chomp
    
  end
  
end

Version data entries

17 entries across 17 versions & 3 rubygems

Version Path
auser-poolparty-1.3.0 test/lib/poolparty/resources/conditional_test.rb
auser-poolparty-1.3.1 test/lib/poolparty/resources/conditional_test.rb
auser-poolparty-1.3.10 test/lib/poolparty/resources/conditional_test.rb
auser-poolparty-1.3.2 test/lib/poolparty/resources/conditional_test.rb
auser-poolparty-1.3.3 test/lib/poolparty/resources/conditional_test.rb
auser-poolparty-1.3.4 test/lib/poolparty/resources/conditional_test.rb
auser-poolparty-1.3.5 test/lib/poolparty/resources/conditional_test.rb
auser-poolparty-1.3.6 test/lib/poolparty/resources/conditional_test.rb
auser-poolparty-1.3.7 test/lib/poolparty/resources/conditional_test.rb
auser-poolparty-1.3.8 test/lib/poolparty/resources/conditional_test.rb
fairchild-poolparty-1.3.5 test/lib/poolparty/resources/conditional_test.rb
poolparty-1.3.8 test/lib/poolparty/resources/conditional_test.rb
poolparty-1.3.7 test/lib/poolparty/resources/conditional_test.rb
poolparty-1.3.6 test/lib/poolparty/resources/conditional_test.rb
poolparty-1.3.4 test/lib/poolparty/resources/conditional_test.rb
poolparty-1.3.3 test/lib/poolparty/resources/conditional_test.rb
poolparty-1.3.1 test/lib/poolparty/resources/conditional_test.rb