Sha256: b522e0f5be7f60456c838a0cb213110eb710aad1f1c502c9551f20aac3eb3ec7

Contents?: true

Size: 1.54 KB

Versions: 21

Compression:

Stored size: 1.54 KB

Contents

require 'chef'

module MiniTest
  module Chef
    module Infections extend ::Chef::Mixin::ConvertToClassName

      def self.infect_resource(resource, meth, new_name)
        clazz = ::Chef::Resource.const_get(convert_to_class_name(resource.to_s))
        clazz.infect_an_assertion "assert_#{meth}".to_sym,
          "must_#{new_name}".to_sym, :only_one_argument
        clazz.infect_an_assertion "refute_#{meth}".to_sym,
          "wont_#{new_name}".to_sym, :only_one_argument
      end

      infect_resource :cron, :cron_exists, :exist
      infect_resource :directory, :modified_after, :be_modified_after
      infect_resource :directory, :path_exists, :exist
      infect_resource :file, :includes_content, :include
      infect_resource :file, :matches_content, :match
      infect_resource :file, :modified_after, :be_modified_after
      infect_resource :file, :path_exists, :exist
      infect_resource :group, :group_exists, :exist
      infect_resource :ifconfig, :ifconfig_exists, :exist
      infect_resource :link, :link_exists, :exist
      infect_resource :mount, :mounted, :be_mounted
      infect_resource :mount, :mount_enabled, :be_enabled
      infect_resource :service, :enabled, :be_enabled
      infect_resource :service, :running, :be_running
      infect_resource :package, :installed, :be_installed
      infect_resource :user, :user_exists, :exist

      ::Chef::Resource::Group.infect_an_assertion :assert_group_includes, :must_include
      ::Chef::Resource::Group.infect_an_assertion :refute_group_includes, :wont_include

    end
  end
end

Version data entries

21 entries across 21 versions & 1 rubygems

Version Path
minitest-chef-handler-1.1.0 lib/minitest-chef-handler/infections.rb
minitest-chef-handler-1.0.3 lib/minitest-chef-handler/infections.rb
minitest-chef-handler-1.0.2 lib/minitest-chef-handler/infections.rb
minitest-chef-handler-1.0.1 lib/minitest-chef-handler/infections.rb
minitest-chef-handler-1.0.0 lib/minitest-chef-handler/infections.rb
minitest-chef-handler-0.6.9 lib/minitest-chef-handler/infections.rb
minitest-chef-handler-0.6.8 lib/minitest-chef-handler/infections.rb
minitest-chef-handler-0.6.7 lib/minitest-chef-handler/infections.rb
minitest-chef-handler-0.6.6 lib/minitest-chef-handler/infections.rb
minitest-chef-handler-0.6.5 lib/minitest-chef-handler/infections.rb
minitest-chef-handler-0.6.4 lib/minitest-chef-handler/infections.rb
minitest-chef-handler-0.6.3 lib/minitest-chef-handler/infections.rb
minitest-chef-handler-0.6.2 lib/minitest-chef-handler/infections.rb
minitest-chef-handler-0.6.1 lib/minitest-chef-handler/infections.rb
minitest-chef-handler-0.6.0 lib/minitest-chef-handler/infections.rb
minitest-chef-handler-0.5.4 lib/minitest-chef-handler/infections.rb
minitest-chef-handler-0.5.3 lib/minitest-chef-handler/infections.rb
minitest-chef-handler-0.5.2 lib/minitest-chef-handler/infections.rb
minitest-chef-handler-0.5.1 lib/minitest-chef-handler/infections.rb
minitest-chef-handler-0.5.0 lib/minitest-chef-handler/infections.rb