Sha256: 7b1aac56f2de238eac51b06bcb434ad19178a88db3e616de1c59e3fb86b2ccd8

Contents?: true

Size: 1.87 KB

Versions: 15

Compression:

Stored size: 1.87 KB

Contents

require 'spec_helper'

module Beaker
  module Utils
    describe Validator do
      let( :validator )      { Beaker::Utils::Validator }
      let( :pkgs )           { Beaker::Utils::Validator::PACKAGES }
      let( :unix_only_pkgs ) { Beaker::Utils::Validator::UNIX_PACKAGES }
      let( :platform )       { @platform || 'unix' }
      let( :hosts )          { hosts = make_hosts( { :platform => platform } )
                               hosts[0][:roles] = ['agent']
                               hosts[1][:roles] = ['master', 'dashboard', 'agent', 'database']
                               hosts[2][:roles] = ['agent']
                               hosts }

      context "can validate the SUTs" do

        it "can validate unix hosts" do

          hosts.each do |host|
            pkgs.each do |pkg|
              host.should_receive( :check_for_package ).with( pkg ).once.and_return( false )
              host.should_receive( :install_package ).with( pkg ).once
            end
            unix_only_pkgs.each do |pkg|
              host.should_receive( :check_for_package ).with( pkg ).once.and_return( false )
              host.should_receive( :install_package ).with( pkg ).once
            end
            
          end

          validator.validate(hosts, logger)

        end

        it "can validate windows hosts" do
          @platform = 'windows'

          hosts.each do |host|
            pkgs.each do |pkg|
              host.should_receive( :check_for_package ).with( pkg ).once.and_return( false )
              host.should_receive( :install_package ).with( pkg ).once
            end
            unix_only_pkgs.each do |pkg|
              host.should_receive( :check_for_package).with( pkg ).never
              host.should_receive( :install_package ).with( pkg ).never
            end
          end

          validator.validate(hosts, logger)

        end
      end


    end
  end
end

Version data entries

15 entries across 15 versions & 1 rubygems

Version Path
beaker-1.7.0 spec/beaker/utils/validator_spec.rb
beaker-1.6.2 spec/beaker/utils/validator_spec.rb
beaker-1.6.1 spec/beaker/utils/validator_spec.rb
beaker-1.6.0 spec/beaker/utils/validator_spec.rb
beaker-1.5.0 spec/beaker/utils/validator_spec.rb
beaker-1.4.1 spec/beaker/utils/validator_spec.rb
beaker-1.4.0 spec/beaker/utils/validator_spec.rb
beaker-1.3.2 spec/beaker/utils/validator_spec.rb
beaker-1.3.1 spec/beaker/utils/validator_spec.rb
beaker-1.3.0 spec/beaker/utils/validator_spec.rb
beaker-1.2.0 spec/beaker/utils/validator_spec.rb
beaker-1.1.0 spec/beaker/utils/validator_spec.rb
beaker-1.0.1 spec/beaker/utils/validator_spec.rb
beaker-1.0.1.pre spec/beaker/utils/validator_spec.rb
beaker-1.0.0 spec/beaker/utils/validator_spec.rb