Skip to content
Extraits de code Groupes Projets
  • Pistos's avatar
    78a96a18
    This fixes issue #2298. · 78a96a18
    Pistos a rédigé
    Following a hashtag with a dot now no longer breaks the user's stream page.
    All unacceptable hashtag chars are stripped out, and the given tag is
    normalized before being followed.
    78a96a18
    Historique
    This fixes issue #2298.
    Pistos a rédigé
    Following a hashtag with a dot now no longer breaks the user's stream page.
    All unacceptable hashtag chars are stripped out, and the given tag is
    normalized before being followed.
spec-doc.rb 471 o
class SpecDoc
  def initialize(response)
    @html = Nokogiri::HTML(response.body)
  end

  def method_missing(method, *args)
    @html.send method, *args
  end

  def has_content?(string)
    escaped = string.gsub("'", "\\'")
    @html.xpath("//*[contains(text(), '#{escaped}')]").any?
  end
  def has_no_content?(string)
    ! has_content?(string)
  end

  def has_link?(text)
    @html.xpath("//a[text()='#{text}']").any?
  end
end

def doc
  SpecDoc.new response
end