class RSpecHtmlMatchers::HaveTag

def initialize tag, options = {}, &block

def initialize tag, options = {}, &block
  @tag = tag.to_s
  @options = options
  @block = block
  if with_attrs = @options.delete(:with)
    if classes = with_attrs.delete(:class)
      @tag += '.' + classes_to_selector(classes)
    end
    selector = with_attrs.inject('') do |html_attrs_string, (k, v)|
      html_attrs_string += "[#{k}='#{v}']"
      html_attrs_string
    end
    @tag += selector
  end
  if without_attrs = @options.delete(:without)
    if classes = without_attrs.delete(:class)
      @tag += ":not(.#{classes_to_selector(classes)})"
    end
  end
  validate_options!
  organize_options!
end