Sha256: aa520a7eabe43b1ac8e133777bff15053889958de79e4510483dad5f70a74b8b

Contents?: true

Size: 860 Bytes

Versions: 1

Compression:

Stored size: 860 Bytes

Contents

require 'test_helper'
require 'webmock/minitest'

module Wovnrb
  class ReplacerBaseTest < WovnMiniTest
    def test_wovn_ignore
      replacer = ReplacerBase.new
      dom = Wovnrb.to_dom('<html><body><div wovn-ignore></div></body></html>')
      actual = replacer.send(:wovn_ignore?, dom.xpath('//div')[0])

      assert(actual)
    end

    def test_wovn_ignore_parent
      replacer = ReplacerBase.new
      dom = Wovnrb.to_dom('<html wovn-ignore><body><div wovn-ignore></div></body></html>')
      actual = replacer.send(:wovn_ignore?, dom.xpath('//div')[0])

      assert(actual)
    end

    def test_wovn_ignore_without_attribute
      replacer = ReplacerBase.new
      dom = Wovnrb.to_dom('<html><body><div></div></body></html>')
      actual = replacer.send(:wovn_ignore?, dom.xpath('//div')[0])

      assert_equal(false, actual)
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
wovnrb-0.2.02 test/lib/html_replacers/replacer_base_test.rb