# -*- encoding: UTF-8 -*-
require 'test_helper'
require 'webmock/minitest'
module Wovnrb
class ImageReplacerTest < WovnMiniTest
def test_replace
url = {
:protocol => 'http',
:host => 'www.example.com',
:pathname => 'hello/index.html'
}
text_index = {
'Hello' => {'ja' => [{'data' => 'こんにちは'}]}
}
src_index = {
'http://www.example.com/test.img' => {'ja' => [{'data' => 'http://test.com/ttt.img'}]}
}
img_src_prefix = 'prefix::'
replacer = ImageReplacer.new(url, text_index, src_index, img_src_prefix)
dom = Wovnrb.get_dom(' 'http',
:host => 'www.example.com',
:path => '/hello/'
}
text_index = {}
src_index = {
'http://www.example.com/hello/test.img' => {'ja' => [{'data' => 'http://test.com/ttt.img'}]}
}
replacer = ImageReplacer.new(url, text_index, src_index, '')
dom = Wovnrb.get_dom(' 'http',
:host => 'www.example.com',
:path => '/hello/'
}
text_index = {}
src_index = {
'http://www.example.com/test.img' => {'ja' => [{'data' => 'http://test.com/ttt.img'}]}
}
replacer = ImageReplacer.new(url, text_index, src_index, '')
dom = Wovnrb.get_dom(' 'http',
:host => 'www.example.com',
:path => '/hello/'
}
text_index = {}
src_index = {
'http://www.test.com/test.img' => {'ja' => [{'data' => 'http://test.com/ttt.img'}]}
}
replacer = ImageReplacer.new(url, text_index, src_index, '')
dom = Wovnrb.get_dom('