def expect_warning(code, options = {})
      if options.has_key?(:file_type)
        options[:file] = { :attributes => "attributes/default.rb", :definition => "definitions/apache_site.rb",
                           :metadata => "metadata.rb", :provider => "providers/site.rb",
                           :resource => "resources/site.rb", :libraries => "libraries/lib.rb" }[options[:file_type]]
      end
      options = { :line => 1, :expect_warning => true, :file => "recipes/default.rb" }.merge!(options)
      unless options[:file].include?("roles") ||
          options[:file].include?("environments")
        options[:file] = "cookbooks/example/#{options[:file]}"
      end
      if options[:warning_only]
        warning = "#{code}: #{WARNINGS[code]}"
      else
        warning = "#{code}: #{WARNINGS[code]}: #{options[:file]}:#{options[:line]}#{"\n" if ! options[:line].nil?}"
      end
      options[:expect_warning] ? expect_output(warning) : expect_no_output(warning)
    end
def expect_warning(code, options = {})
      if options.has_key?(:file_type)
        options[:file] = { :attributes => "attributes/default.rb", :definition => "definitions/apache_site.rb",
                           :metadata => "metadata.rb", :provider => "providers/site.rb",
                           :resource => "resources/site.rb", :libraries => "libraries/lib.rb" }[options[:file_type]]
      end
      options = { :line => 1, :expect_warning => true, :file => "recipes/default.rb" }.merge!(options)
      unless options[:file].include?("roles") ||
          options[:file].include?("environments")
        options[:file] = "cookbooks/example/#{options[:file]}"
      end
      if options[:warning_only]
        warning = "#{code}: #{WARNINGS[code]}"
      else
        warning = "#{code}: #{WARNINGS[code]}: #{options[:file]}:#{options[:line]}#{"\n" if ! options[:line].nil?}"
      end
      options[:expect_warning] ? expect_output(warning) : expect_no_output(warning)
    end
Expect a warning to be included in the command output.

 @param [String] code The warning code to check for.
 @param [Hash] options The warning options.
 @option options [Integer] :line The line number the warning should appear on - nil for any line.
 @option options [Boolean] :expect_warning If false then assert that a warning is NOT present
 @option options [String] :file The path to the file the warning should be raised against
 @option options [Symbol] :file_type Alternative to specifying file name. One of: :attributes, :definition,
   :metadata, :provider, :resource