Sha256: 1fd71564d0e813d714039e001284959620819ac312cff0b505b672f80c60b8b4

Contents?: true

Size: 1.71 KB

Versions: 8

Compression:

Stored size: 1.71 KB

Contents

require 'spec_helper'
require 'kcd/dsl'

module KnifeCookbookDependencies
  describe DSL do
    include DSL

    describe "#cookbook" do
      after do
        KnifeCookbookDependencies.shelf.cookbooks.each(&:clean)
      end

      it 'should add the cookbooks to the shelf' do
        cookbook "ntp"
        cookbook "nginx"

        ['ntp', 'nginx'].each do |cookbook|
          KnifeCookbookDependencies.shelf.cookbooks.collect(&:name).should include cookbook
        end
      end

      it 'should take version constraints' do
        Cookbook.any_instance.stub(:clean)
        cookbook 'ntp', '= 1.2.3'
        KnifeCookbookDependencies.shelf.cookbooks.select {|c| c.name == 'ntp'}.first.version_constraints.first.should == DepSelector::VersionConstraint.new('= 1.2.3')
      end

      it 'should take group' do
        cookbook 'nginx', :group => 'web'
        KnifeCookbookDependencies.shelf.cookbooks.select {|c| c.name == 'nginx'}.first.groups.should == [:web]
      end
    end

    describe '#group' do
      it "should set the group on all cookbooks" do
        cookbooks = %w[hashbrowns mashed_potatoes bourbon]
        group "awesome" do
          cookbooks.each {|c| cookbook c}
        end
        cookbooks.each do |c|
          KnifeCookbookDependencies.shelf.cookbooks.select {|n| n.name == c}.first.groups.should == [:awesome]
        end
      end

      it "should not set the group on cookbooks after the group" do
        cookbooks = %w[apple orange strawberry]
        group "fruit" do
          cookbooks.each {|c| cookbook c}
        end
        cookbook 'sesame_chicken'
        KnifeCookbookDependencies.shelf.cookbooks.select {|n| n.name == 'sesame_chicken'}.first.groups.should == [:default]
      end

    end
  end
end

Version data entries

8 entries across 8 versions & 2 rubygems

Version Path
knife_cookbook_dependencies_over_http-0.0.8.3 spec/lib/kcd/dsl_spec.rb
knife_cookbook_dependencies_over_http-0.0.8.2 spec/lib/kcd/dsl_spec.rb
knife_cookbook_dependencies_over_http-0.0.8.1 spec/lib/kcd/dsl_spec.rb
knife_cookbook_dependencies_over_http-0.0.8 spec/lib/kcd/dsl_spec.rb
knife_cookbook_dependencies-0.0.8 spec/lib/kcd/dsl_spec.rb
knife_cookbook_dependencies-0.0.7 spec/lib/kcd/dsl_spec.rb
knife_cookbook_dependencies-0.0.6 spec/lib/kcd/dsl_spec.rb
knife_cookbook_dependencies-0.0.5 spec/lib/kcd/dsl_spec.rb