Sha256: 0adef062a81e0d4afe480a8bed198786cc294e870c3173bc07997a46ee4c6f66
Contents?: true
Size: 1.46 KB
Versions: 4
Compression:
Stored size: 1.46 KB
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 def test_replace_text replacer = ReplacerBase.new actual = replacer.send(:replace_text, 'Hello', 'こんにちは') assert_equal('こんにちは', actual) end def test_replace_text_with_space replacer = ReplacerBase.new actual = replacer.send(:replace_text, ' Hello ', 'こんにちは') assert_equal(' こんにちは ', actual) end def test_replace_text_with_line_break replacer = ReplacerBase.new actual = replacer.send(:replace_text, " Hello \n Hello ", 'こんにちは') assert_equal(' こんにちは ', actual) end end end
Version data entries
4 entries across 4 versions & 1 rubygems