Sha256: b2e2665a0afdc4bd3157ab19789f51888c08d7d216cccf58e44b66e76da82770

Contents?: true

Size: 1.08 KB

Versions: 3

Compression:

Stored size: 1.08 KB

Contents

module Helpers
  module Apache
    include MiniTest::Chef::Assertions
    include MiniTest::Chef::Context
    include MiniTest::Chef::Resources

    def apache_config_parses?
      %x{#{node['apache']['binary']} -t}
      $?.success?
    end
    def apache_configured_ports
      port_config = File.read("#{node['apache']['dir']}/ports.conf")
      port_config.scan(/^Listen ([0-9]+)/).flatten.map{|p| p.to_i}
    end
    def apache_enabled_modules
      Dir["#{node['apache']['dir']}/mods-enabled/*.load"].map{|s| File.basename(s, '.load')}.sort
    end
    def apache_service
      service(case node['platform']
        when "debian","ubuntu" then "apache2"
        when "freebsd" then "apache22"
        else "httpd"
      end)
    end
    def config
      file(case node['platform']
        when "debian","ubuntu" then "#{node['apache']['dir']}/apache2.conf"
        when "freebsd" then "#{node['apache']['dir']}/httpd.conf"
        else "#{node['apache']['dir']}/conf/httpd.conf"
      end)
    end
    def ran_recipe?(recipe)
      node.run_state[:seen_recipes].keys.include?(recipe)
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
fast_food-0.1.2 chef/cookbooks/apache2/files/default/tests/minitest/helpers.rb
fast_food-0.1.1 chef/cookbooks/apache2/files/default/tests/minitest/helpers.rb
fast_food-0.1.0 chef/cookbooks/apache2/files/default/tests/minitest/helpers.rb