class GeneratorSpec::Matcher::File

def check_contents(file)

def check_contents(file)
  contents = ::File.read(file)
  @contents.each do |string|
    unless contents.include?(string)
      throw :failure, [file, string, contents]
    end
  end
  @negative_contents.each do |string|
    if contents.include?(string)
      throw :failure, [:not, file, string, contents]
    end
  end
end

def contains(text)

def contains(text)
  @contents << text
end

def description

def description
  'file attributes and content'
end

def does_not_contain(text)

def does_not_contain(text)
  @negative_contents << text
end

def initialize(name, &block)

def initialize(name, &block)
  @contents = []
  @name = name
  @negative_contents = []
  if block_given?
    instance_eval(&block)
  end
end

def matches?(root)

def matches?(root)
  unless root.join(@name).exist?
    throw :failure, root.join(@name)
  end
  check_contents(root.join(@name))
end