Sha256: 7c31522e1a82c42d95722b347c4330bc347662667815f0af0b8b37d5c39c4a51

Contents?: true

Size: 429 Bytes

Versions: 11

Compression:

Stored size: 429 Bytes

Contents

require 'nokogiri'

module NokogiriMatchers
  class HtmlMatchers
    def initialize(tag)
      @tag = tag.to_s
    end
    def matches?(document)
      @document = Nokogiri::HTML.fragment document
      !@document.search(@tag).nil?
    end

    def failure_message_for_should
      "expected to find #{@tag} within #{@document.to_s} but was not found"
    end
  end

  def have_tag(expect)
    HtmlMatchers.new(expect)
  end
end

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
awestruct-0.5.4.rc3 spec/support/nokogiri_matchers.rb
awestruct-0.5.4.rc2 spec/support/nokogiri_matchers.rb
awestruct-0.5.4.rc spec/support/nokogiri_matchers.rb
awestruct-0.5.4.beta1 spec/support/nokogiri_matchers.rb
awestruct-0.5.3 spec/support/nokogiri_matchers.rb
awestruct-0.5.2.1 spec/support/nokogiri_matchers.rb
awestruct-0.5.2 spec/support/nokogiri_matchers.rb
awestruct-0.5.1 spec/support/nokogiri_matchers.rb
awestruct-0.5.1a spec/support/nokogiri_matchers.rb
awestruct-0.5.0 spec/support/nokogiri_matchers.rb
awestruct-0.5.0.cr spec/support/nokogiri_matchers.rb