wovnrb 1.1.0 → 2.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.circleci/config.yml +1 -0
- data/.gitignore +2 -0
- data/.rubocop.yml +1 -0
- data/.rubocop_todo.yml +308 -0
- data/Rakefile +13 -14
- data/lib/wovnrb.rb +43 -98
- data/lib/wovnrb/api_translator.rb +143 -0
- data/lib/wovnrb/headers.rb +78 -92
- data/lib/wovnrb/helpers/nokogumbo_helper.rb +1 -1
- data/lib/wovnrb/lang.rb +93 -125
- data/lib/wovnrb/railtie.rb +5 -7
- data/lib/wovnrb/services/glob.rb +3 -3
- data/lib/wovnrb/services/html_converter.rb +192 -0
- data/lib/wovnrb/services/html_replace_marker.rb +38 -0
- data/lib/wovnrb/services/wovn_logger.rb +8 -4
- data/lib/wovnrb/settings.rb +5 -3
- data/lib/wovnrb/store.rb +35 -26
- data/lib/wovnrb/text_caches/cache_base.rb +3 -2
- data/lib/wovnrb/text_caches/memory_cache.rb +2 -2
- data/lib/wovnrb/version.rb +1 -1
- data/test/fixtures/html/test.html +8 -0
- data/test/fixtures/html/test_translated.html +8 -0
- data/test/lib/api_translator_test.rb +109 -0
- data/test/lib/headers_test.rb +84 -55
- data/test/lib/lang_test.rb +157 -357
- data/test/lib/services/glob_test.rb +1 -1
- data/test/lib/services/html_converter_test.rb +166 -0
- data/test/lib/services/html_replace_marker_test.rb +75 -0
- data/test/lib/services/wovn_logger_test.rb +6 -6
- data/test/lib/store_test.rb +25 -69
- data/test/lib/text_caches/cache_base_test.rb +1 -1
- data/test/lib/text_caches/memory_cache_test.rb +10 -11
- data/test/lib/wovnrb_test.rb +77 -310
- data/test/test_helper.rb +22 -32
- data/wovnrb.gemspec +35 -44
- metadata +86 -205
- data/ext/dom/Makefile +0 -239
- data/lib/wovnrb/api_data.rb +0 -59
- data/lib/wovnrb/html_replacers/image_replacer.rb +0 -69
- data/lib/wovnrb/html_replacers/input_replacer.rb +0 -38
- data/lib/wovnrb/html_replacers/link_replacer.rb +0 -78
- data/lib/wovnrb/html_replacers/meta_replacer.rb +0 -28
- data/lib/wovnrb/html_replacers/replacer_base.rb +0 -49
- data/lib/wovnrb/html_replacers/script_replacer.rb +0 -39
- data/lib/wovnrb/html_replacers/text_replacer.rb +0 -21
- data/lib/wovnrb/html_replacers/unified_values/dst_swapping_targets_creator.rb +0 -76
- data/lib/wovnrb/html_replacers/unified_values/element_category.rb +0 -242
- data/lib/wovnrb/html_replacers/unified_values/node_swapping_targets_creator.rb +0 -134
- data/lib/wovnrb/html_replacers/unified_values/text_replacer.rb +0 -35
- data/lib/wovnrb/html_replacers/unified_values/text_scraper.rb +0 -152
- data/lib/wovnrb/html_replacers/unified_values/values_stack.rb +0 -65
- data/lib/wovnrb/services/url.rb +0 -12
- data/lib/wovnrb/services/value_agent.rb +0 -9
- data/test/fixtures/unified_values/site_html/simple_actual.html +0 -96
- data/test/fixtures/unified_values/site_html/simple_expected.json +0 -251
- data/test/fixtures/unified_values/site_html/wovn.io_actual.html +0 -686
- data/test/fixtures/unified_values/site_html/wovn.io_expected.json +0 -543
- data/test/fixtures/unified_values/site_html/www.yahoo.co.jp_actual.html +0 -1024
- data/test/fixtures/unified_values/site_html/www.yahoo.co.jp_expected.json +0 -3345
- data/test/fixtures/unified_values/small_html/block_inside_inline_actual.html +0 -12
- data/test/fixtures/unified_values/small_html/block_inside_inline_expected.json +0 -22
- data/test/fixtures/unified_values/small_html/br_tag_actual.html +0 -10
- data/test/fixtures/unified_values/small_html/br_tag_expected.json +0 -12
- data/test/fixtures/unified_values/small_html/comment_tag_actual.html +0 -12
- data/test/fixtures/unified_values/small_html/comment_tag_expected.json +0 -10
- data/test/fixtures/unified_values/small_html/complex_text_with_html_entity_actual.html +0 -7
- data/test/fixtures/unified_values/small_html/complex_text_with_html_entity_expected.json +0 -11
- data/test/fixtures/unified_values/small_html/deep_nested_block_actual.html +0 -14
- data/test/fixtures/unified_values/small_html/deep_nested_block_expected.json +0 -8
- data/test/fixtures/unified_values/small_html/deep_nested_inline_actual.html +0 -20
- data/test/fixtures/unified_values/small_html/deep_nested_inline_expected.json +0 -20
- data/test/fixtures/unified_values/small_html/empty_tag_actual.html +0 -10
- data/test/fixtures/unified_values/small_html/empty_tag_expected.json +0 -12
- data/test/fixtures/unified_values/small_html/empty_text_actual.html +0 -12
- data/test/fixtures/unified_values/small_html/empty_text_expected.json +0 -1
- data/test/fixtures/unified_values/small_html/ignore_tag_actual.html +0 -12
- data/test/fixtures/unified_values/small_html/ignore_tag_expected.json +0 -16
- data/test/fixtures/unified_values/small_html/ignored_class_actual.html +0 -10
- data/test/fixtures/unified_values/small_html/ignored_class_expected.json +0 -13
- data/test/fixtures/unified_values/small_html/img_actual.html +0 -12
- data/test/fixtures/unified_values/small_html/img_expected.json +0 -23
- data/test/fixtures/unified_values/small_html/nested_and_complex_wovn_ignore_actual.html +0 -10
- data/test/fixtures/unified_values/small_html/nested_and_complex_wovn_ignore_expected.json +0 -16
- data/test/fixtures/unified_values/small_html/nested_text_value_actual.html +0 -10
- data/test/fixtures/unified_values/small_html/nested_text_value_expected.json +0 -12
- data/test/fixtures/unified_values/small_html/nested_text_value_mixed_plan_text_actual.html +0 -10
- data/test/fixtures/unified_values/small_html/nested_text_value_mixed_plan_text_expected.json +0 -14
- data/test/fixtures/unified_values/small_html/option_tag_actual.html +0 -9
- data/test/fixtures/unified_values/small_html/option_tag_expected.json +0 -13
- data/test/fixtures/unified_values/small_html/text_different_inline_each_other_actual.html +0 -10
- data/test/fixtures/unified_values/small_html/text_different_inline_each_other_expected.json +0 -22
- data/test/fixtures/unified_values/small_html/text_in_svg_actual.html +0 -9
- data/test/fixtures/unified_values/small_html/text_in_svg_expected.json +0 -8
- data/test/fixtures/unified_values/small_html/text_with_html_entity_actual.html +0 -6
- data/test/fixtures/unified_values/small_html/text_with_html_entity_expected.json +0 -8
- data/test/fixtures/unified_values/small_html/unknown_or_custom_tag_actual.html +0 -12
- data/test/fixtures/unified_values/small_html/unknown_or_custom_tag_expected.json +0 -24
- data/test/fixtures/unified_values/small_html/unnecessay_top_end_tag_actual.html +0 -12
- data/test/fixtures/unified_values/small_html/unnecessay_top_end_tag_expected.json +0 -14
- data/test/fixtures/unified_values/small_html/wovn_ignore_actual.html +0 -10
- data/test/fixtures/unified_values/small_html/wovn_ignore_expected.json +0 -13
- data/test/lib/api_data_test.rb +0 -83
- data/test/lib/html_replacers/image_replacer_test.rb +0 -165
- data/test/lib/html_replacers/input_replacer_test.rb +0 -140
- data/test/lib/html_replacers/link_replacer_test.rb +0 -328
- data/test/lib/html_replacers/meta_replacer_test.rb +0 -157
- data/test/lib/html_replacers/replacer_base_test.rb +0 -128
- data/test/lib/html_replacers/script_replacer_test.rb +0 -139
- data/test/lib/html_replacers/text_replacer_test.rb +0 -99
- data/test/lib/html_replacers/unified_values/dst_swapping_targets_creator_test.rb +0 -137
- data/test/lib/html_replacers/unified_values/element_category_test.rb +0 -49
- data/test/lib/html_replacers/unified_values/node_swapping_targets_creator_test.rb +0 -137
- data/test/lib/html_replacers/unified_values/text_replacer_test.rb +0 -270
- data/test/lib/html_replacers/unified_values/text_scraper_test.rb +0 -121
- data/test/lib/html_replacers/unified_values/values_stack_test.rb +0 -122
- data/test/lib/services/url_test.rb +0 -9
- data/test/lib/services/value_agent_test.rb +0 -32
- data/test/services/url_test.rb +0 -163
- data/values/values +0 -1
@@ -1,121 +0,0 @@
|
|
1
|
-
require 'test_helper'
|
2
|
-
|
3
|
-
module Wovnrb
|
4
|
-
module UnifiedValues
|
5
|
-
class TextScraperTest < WovnMiniTest
|
6
|
-
def assert_shared_fixture(base_name, ignored_classes = Set.new)
|
7
|
-
html = File.read("test/fixtures/unified_values/#{base_name}_actual.html")
|
8
|
-
expected_values = JSON.parse(File.read("test/fixtures/unified_values/#{base_name}_expected.json"))
|
9
|
-
|
10
|
-
dom = Nokogiri::HTML5.parse(html)
|
11
|
-
actual_values = TextScraper.new(ignored_classes).run(dom)
|
12
|
-
|
13
|
-
assert_shared_fixture_values(expected_values, actual_values)
|
14
|
-
end
|
15
|
-
|
16
|
-
def assert_shared_fixture_values(expected_values, actual_values)
|
17
|
-
expected_values.zip(actual_values).each do |expected_value, actual|
|
18
|
-
assert_equal(expected_value['srcs'].join, actual[:dst])
|
19
|
-
assert_equal(expected_value['srcs'].size, actual[:nodes].size)
|
20
|
-
end
|
21
|
-
assert_equal(expected_values.length, actual_values.length)
|
22
|
-
end
|
23
|
-
|
24
|
-
def test_shared_fixture
|
25
|
-
assert_shared_fixture('site_html/simple')
|
26
|
-
end
|
27
|
-
|
28
|
-
def test_shared_fixture_of_wovn
|
29
|
-
assert_shared_fixture('site_html/wovn.io')
|
30
|
-
end
|
31
|
-
|
32
|
-
def test_shared_fixture_of_yahoo_jp
|
33
|
-
assert_shared_fixture('site_html/www.yahoo.co.jp')
|
34
|
-
end
|
35
|
-
|
36
|
-
def test_run_fixtures_of_nested_text_value
|
37
|
-
assert_shared_fixture('small_html/nested_text_value')
|
38
|
-
end
|
39
|
-
|
40
|
-
def test_run_fixtures_of_nested_text_value_mixed_plan_text
|
41
|
-
assert_shared_fixture('small_html/nested_text_value_mixed_plan_text')
|
42
|
-
end
|
43
|
-
|
44
|
-
def test_run_fixtures_of_block_inside_inline
|
45
|
-
assert_shared_fixture('small_html/block_inside_inline')
|
46
|
-
end
|
47
|
-
|
48
|
-
def test_run_fixtures_of_br_tag
|
49
|
-
assert_shared_fixture('small_html/br_tag')
|
50
|
-
end
|
51
|
-
|
52
|
-
def test_run_fixtures_of_empty_text
|
53
|
-
assert_shared_fixture('small_html/empty_text')
|
54
|
-
end
|
55
|
-
|
56
|
-
def test_run_fixtures_of_comment_tag
|
57
|
-
assert_shared_fixture('small_html/comment_tag')
|
58
|
-
end
|
59
|
-
|
60
|
-
def test_run_fixtures_of_ignore_tag
|
61
|
-
assert_shared_fixture('small_html/ignore_tag')
|
62
|
-
end
|
63
|
-
|
64
|
-
def test_run_fixtures_of_empty_tag
|
65
|
-
assert_shared_fixture('small_html/empty_tag')
|
66
|
-
end
|
67
|
-
|
68
|
-
def test_run_fixtures_of_deep_nested_block
|
69
|
-
assert_shared_fixture('small_html/deep_nested_block')
|
70
|
-
end
|
71
|
-
|
72
|
-
def test_run_fixtures_of_deep_nested_inline
|
73
|
-
assert_shared_fixture('small_html/deep_nested_inline')
|
74
|
-
end
|
75
|
-
|
76
|
-
def test_run_fixtures_of_text_different_inline_each_other
|
77
|
-
assert_shared_fixture('small_html/text_different_inline_each_other')
|
78
|
-
end
|
79
|
-
|
80
|
-
def test_run_fixtures_of_wovn_ignore
|
81
|
-
assert_shared_fixture('small_html/wovn_ignore')
|
82
|
-
end
|
83
|
-
|
84
|
-
def test_run_fixtures_of_ignored_class
|
85
|
-
assert_shared_fixture('small_html/ignored_class', Set.new(['ignore-me']))
|
86
|
-
end
|
87
|
-
|
88
|
-
def test_run_fixtures_of_nested_and_complex_wovn_ignore
|
89
|
-
assert_shared_fixture('small_html/nested_and_complex_wovn_ignore')
|
90
|
-
end
|
91
|
-
|
92
|
-
def test_run_fixtures_of_text_in_svg
|
93
|
-
assert_shared_fixture('small_html/text_in_svg')
|
94
|
-
end
|
95
|
-
|
96
|
-
def test_run_fixtures_of_text_with_html_entity
|
97
|
-
assert_shared_fixture('small_html/text_with_html_entity')
|
98
|
-
end
|
99
|
-
|
100
|
-
def test_run_fixtures_of_complex_text_with_html_entity
|
101
|
-
assert_shared_fixture('small_html/complex_text_with_html_entity')
|
102
|
-
end
|
103
|
-
|
104
|
-
def test_run_fixtures_of_unknown_or_custom_tag
|
105
|
-
assert_shared_fixture('small_html/unknown_or_custom_tag')
|
106
|
-
end
|
107
|
-
|
108
|
-
def test_run_fixtures_of_unnecessay_top_end_tag
|
109
|
-
assert_shared_fixture('small_html/unnecessay_top_end_tag')
|
110
|
-
end
|
111
|
-
|
112
|
-
def test_run_fixtures_of_option_tag
|
113
|
-
assert_shared_fixture('small_html/option_tag')
|
114
|
-
end
|
115
|
-
|
116
|
-
def test_run_fixtures_of_img
|
117
|
-
assert_shared_fixture('small_html/img')
|
118
|
-
end
|
119
|
-
end
|
120
|
-
end
|
121
|
-
end
|
@@ -1,122 +0,0 @@
|
|
1
|
-
require 'test_helper'
|
2
|
-
|
3
|
-
module Wovnrb
|
4
|
-
module UnifiedValues
|
5
|
-
class ValueStackTest < WovnMiniTest
|
6
|
-
def setup
|
7
|
-
@doc = Nokogiri('<html></html>')
|
8
|
-
end
|
9
|
-
|
10
|
-
def test_initialize
|
11
|
-
stack = ValuesStack.new('/html/body/path', 10)
|
12
|
-
assert_equal('/html/body/path', stack.instance_variable_get(:@head_path))
|
13
|
-
assert_equal(10, stack.instance_variable_get(:@index))
|
14
|
-
assert_equal([], stack.instance_variable_get(:@node_stack))
|
15
|
-
assert_equal([], stack.instance_variable_get(:@src_stack))
|
16
|
-
assert_equal([], stack.instance_variable_get(:@src_without_tag_stack))
|
17
|
-
end
|
18
|
-
|
19
|
-
def test_add
|
20
|
-
stack = ValuesStack.new('/html/body/path', 10)
|
21
|
-
assert_equal([], stack.instance_variable_get(:@src_stack))
|
22
|
-
assert_equal([], stack.instance_variable_get(:@src_without_tag_stack))
|
23
|
-
|
24
|
-
text_node = Nokogiri::XML::Text.new('hello', @doc)
|
25
|
-
stack.add(text_node, 'hello')
|
26
|
-
assert_equal([text_node], stack.instance_variable_get(:@node_stack))
|
27
|
-
assert_equal(['hello'], stack.instance_variable_get(:@src_stack))
|
28
|
-
assert_equal([], stack.instance_variable_get(:@src_without_tag_stack))
|
29
|
-
end
|
30
|
-
|
31
|
-
def test_add_with_spaces
|
32
|
-
stack = ValuesStack.new('/html/body/path', 10)
|
33
|
-
assert_equal([], stack.instance_variable_get(:@src_stack))
|
34
|
-
|
35
|
-
text_node = Nokogiri::XML::Text.new(' hello ', @doc)
|
36
|
-
stack.add(text_node, ' hello ')
|
37
|
-
assert_equal([text_node], stack.instance_variable_get(:@node_stack))
|
38
|
-
assert_equal(['hello'], stack.instance_variable_get(:@src_stack))
|
39
|
-
end
|
40
|
-
|
41
|
-
def test_add_text_element
|
42
|
-
stack = ValuesStack.new('/html/body/path', 10)
|
43
|
-
assert_equal([], stack.instance_variable_get(:@src_stack))
|
44
|
-
assert_equal([], stack.instance_variable_get(:@src_without_tag_stack))
|
45
|
-
|
46
|
-
text_node = Nokogiri::XML::Text.new('hello', @doc)
|
47
|
-
stack.add_text_element(text_node, 'hello')
|
48
|
-
assert_equal([text_node], stack.instance_variable_get(:@node_stack))
|
49
|
-
assert_equal(['hello'], stack.instance_variable_get(:@src_stack))
|
50
|
-
assert_equal(['hello'], stack.instance_variable_get(:@src_without_tag_stack))
|
51
|
-
end
|
52
|
-
|
53
|
-
def test_add_text_element_with_special_character
|
54
|
-
stack = ValuesStack.new('/html/body/path', 10)
|
55
|
-
assert_equal([], stack.instance_variable_get(:@src_stack))
|
56
|
-
assert_equal([], stack.instance_variable_get(:@src_without_tag_stack))
|
57
|
-
text_node = Nokogiri::XML::Text.new(' <hello> ', @doc)
|
58
|
-
stack.add_text_element(text_node, ' <hello> ')
|
59
|
-
assert_equal([text_node], stack.instance_variable_get(:@node_stack))
|
60
|
-
assert_equal(['<hello>'], stack.instance_variable_get(:@src_stack))
|
61
|
-
assert_equal(['<hello>'], stack.instance_variable_get(:@src_without_tag_stack))
|
62
|
-
end
|
63
|
-
|
64
|
-
def test_blank
|
65
|
-
stack = ValuesStack.new('/html/body/path', 10)
|
66
|
-
assert_equal(true, stack.blank?)
|
67
|
-
text_node = Nokogiri::XML::Text.new('hello', @doc)
|
68
|
-
stack.add(text_node, 'hello')
|
69
|
-
assert_equal(false, stack.blank?)
|
70
|
-
end
|
71
|
-
|
72
|
-
def test_path
|
73
|
-
stack = ValuesStack.new('/html/body/path', 10)
|
74
|
-
assert_equal('/html/body/path/text()[10]', stack.path)
|
75
|
-
end
|
76
|
-
|
77
|
-
def test_path_first_index
|
78
|
-
stack = ValuesStack.new('/html/body/path', 1)
|
79
|
-
assert_equal('/html/body/path/text()', stack.path)
|
80
|
-
end
|
81
|
-
|
82
|
-
def test_path_title
|
83
|
-
stack = ValuesStack.new('/html/head/title', 1)
|
84
|
-
assert_equal('/html/head/title', stack.path)
|
85
|
-
end
|
86
|
-
|
87
|
-
def test_src
|
88
|
-
stack = ValuesStack.new('/html/body/path', 10)
|
89
|
-
stack.instance_variable_set(:@src_stack, ['hello', '<span>', 'world'])
|
90
|
-
assert_equal('hello<span>world', stack.src)
|
91
|
-
end
|
92
|
-
|
93
|
-
def test_src_without_tag
|
94
|
-
stack = ValuesStack.new('/html/body/path', 10)
|
95
|
-
stack.instance_variable_set(:@src_without_tag_stack, ['hello', '<span>', 'world'])
|
96
|
-
assert_equal('hello<span>world', stack.src_without_tag)
|
97
|
-
end
|
98
|
-
|
99
|
-
def test_build_next_stack
|
100
|
-
stack = ValuesStack.new('/html/body/path', 10)
|
101
|
-
node1 = Nokogiri::XML::Text.new('hello', @doc)
|
102
|
-
node2 = Nokogiri::XML::Node.new('span', @doc)
|
103
|
-
node3 = Nokogiri::XML::Text.new('world', @doc)
|
104
|
-
stack.instance_variable_set(:@node_stack, [node1, node2, node3])
|
105
|
-
stack.instance_variable_set(:@src_stack, ['hello', '<span>', 'world'])
|
106
|
-
stack.instance_variable_set(:@src_without_tag_stack, ['hello', '<span>', 'world'])
|
107
|
-
assert_equal('/html/body/path', stack.instance_variable_get(:@head_path))
|
108
|
-
assert_equal(10, stack.instance_variable_get(:@index))
|
109
|
-
assert_equal([node1, node2, node3], stack.instance_variable_get(:@node_stack))
|
110
|
-
assert_equal(['hello', '<span>', 'world'], stack.instance_variable_get(:@src_stack))
|
111
|
-
assert_equal(['hello', '<span>', 'world'], stack.instance_variable_get(:@src_without_tag_stack))
|
112
|
-
|
113
|
-
next_stack = stack.build_next_stack
|
114
|
-
assert_equal('/html/body/path', next_stack.instance_variable_get(:@head_path))
|
115
|
-
assert_equal(11, next_stack.instance_variable_get(:@index))
|
116
|
-
assert_equal([], next_stack.instance_variable_get(:@node_stack))
|
117
|
-
assert_equal([], next_stack.instance_variable_get(:@src_stack))
|
118
|
-
assert_equal([], next_stack.instance_variable_get(:@src_without_tag_stack))
|
119
|
-
end
|
120
|
-
end
|
121
|
-
end
|
122
|
-
end
|
@@ -1,32 +0,0 @@
|
|
1
|
-
require 'test_helper'
|
2
|
-
require 'wovnrb/services/value_agent'
|
3
|
-
|
4
|
-
module Wovnrb
|
5
|
-
class ValueAgentTest < WovnMiniTest
|
6
|
-
def test_normalize_text_with_spaces
|
7
|
-
assert_equal('test string', ValueAgent.normalize_text(' test string '))
|
8
|
-
end
|
9
|
-
|
10
|
-
def test_normalize_text_without_spaces
|
11
|
-
assert_equal('foobar', ValueAgent.normalize_text('foobar'))
|
12
|
-
end
|
13
|
-
|
14
|
-
def test_normalize_text_with_japanese_sapces
|
15
|
-
assert_equal('おはよう ございます', ValueAgent.normalize_text(' おはよう ございます '))
|
16
|
-
end
|
17
|
-
|
18
|
-
def test_normalize_text_with_newlines
|
19
|
-
assert_equal('こんにちは さようなら', ValueAgent.normalize_text("\nこんにちは\nさようなら\n"))
|
20
|
-
end
|
21
|
-
|
22
|
-
def test_normalize_text_with_replacement_char
|
23
|
-
assert_equal("2011年には地下1\b階・地上4\b階の", ValueAgent.normalize_text("\n2011年には地下1�階・地上4�階の\n"))
|
24
|
-
end
|
25
|
-
|
26
|
-
def test_normalize_text_with_nbsp
|
27
|
-
nbsp = "\u00A0"
|
28
|
-
assert_equal("hello,#{nbsp}hello", ValueAgent.normalize_text("#{nbsp}hello,#{nbsp}hello#{nbsp}"))
|
29
|
-
end
|
30
|
-
end
|
31
|
-
end
|
32
|
-
|
data/test/services/url_test.rb
DELETED
@@ -1,163 +0,0 @@
|
|
1
|
-
require 'wovnrb/services/url'
|
2
|
-
|
3
|
-
class URLTest < Minitest::Test
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
def test_prepend_path
|
8
|
-
assert_equal('http://www.google.com/new_dir/test/', Wovnrb::URL.prepend_path('http://www.google.com/test/', 'new_dir'))
|
9
|
-
end
|
10
|
-
|
11
|
-
def test_prepend_path_long_path
|
12
|
-
assert_equal('http://www.google.com/new_dir/test/try/again/', Wovnrb::URL.prepend_path('http://www.google.com/test/try/again/', 'new_dir'))
|
13
|
-
end
|
14
|
-
|
15
|
-
def test_prepend_path_no_trailing_slash
|
16
|
-
assert_equal('http://www.google.com/new_dir/test', Wovnrb::URL.prepend_path('http://www.google.com/test', 'new_dir'))
|
17
|
-
end
|
18
|
-
|
19
|
-
def test_prepend_path_long_path_no_trailing_slash
|
20
|
-
assert_equal('http://www.google.com/new_dir/test/try/again', Wovnrb::URL.prepend_path('http://www.google.com/test/try/again', 'new_dir'))
|
21
|
-
end
|
22
|
-
|
23
|
-
def test_prepend_path_no_path
|
24
|
-
assert_equal('http://www.google.com/new_dir/', Wovnrb::URL.prepend_path('http://www.google.com/', 'new_dir'))
|
25
|
-
end
|
26
|
-
|
27
|
-
def test_prepend_path_no_path_no_trailing_slash
|
28
|
-
assert_equal('http://www.google.com/new_dir', Wovnrb::URL.prepend_path('http://www.google.com', 'new_dir'))
|
29
|
-
end
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
def test_prepend_path_no_host
|
34
|
-
assert_equal('http://google.com/new_dir/test/', Wovnrb::URL.prepend_path('http://google.com/test/', 'new_dir'))
|
35
|
-
end
|
36
|
-
|
37
|
-
def test_prepend_path_no_host_long_path
|
38
|
-
assert_equal('http://google.com/new_dir/test/try/again/', Wovnrb::URL.prepend_path('http://google.com/test/try/again/', 'new_dir'))
|
39
|
-
end
|
40
|
-
|
41
|
-
def test_prepend_path_no_host_no_trailing_slash
|
42
|
-
assert_equal('http://google.com/new_dir/test', Wovnrb::URL.prepend_path('http://google.com/test', 'new_dir'))
|
43
|
-
end
|
44
|
-
|
45
|
-
def test_prepend_path_no_host_long_path_no_trailing_slash
|
46
|
-
assert_equal('http://google.com/new_dir/test/try/again', Wovnrb::URL.prepend_path('http://google.com/test/try/again', 'new_dir'))
|
47
|
-
end
|
48
|
-
|
49
|
-
def test_prepend_path_no_host_no_path
|
50
|
-
assert_equal('http://google.com/new_dir/', Wovnrb::URL.prepend_path('http://google.com/', 'new_dir'))
|
51
|
-
end
|
52
|
-
|
53
|
-
def test_prepend_path_no_host_no_path_no_trailing_slash
|
54
|
-
assert_equal('http://google.com/new_dir', Wovnrb::URL.prepend_path('http://google.com', 'new_dir'))
|
55
|
-
end
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
def test_prepend_path_no_protocol
|
60
|
-
assert_equal('www.facebook.com/dir/test/', Wovnrb::URL.prepend_path('www.facebook.com/test/', 'dir'))
|
61
|
-
end
|
62
|
-
|
63
|
-
def test_prepend_path_no_protocol_long_path
|
64
|
-
assert_equal('www.facebook.com/dir/test/try/again/', Wovnrb::URL.prepend_path('www.facebook.com/test/try/again/', 'dir'))
|
65
|
-
end
|
66
|
-
|
67
|
-
def test_prepend_path_no_protocol_no_trailing_slash
|
68
|
-
assert_equal('www.facebook.com/dir/test', Wovnrb::URL.prepend_path('www.facebook.com/test', 'dir'))
|
69
|
-
end
|
70
|
-
|
71
|
-
def test_prepend_path_no_protocol_long_path_no_trailing_slash
|
72
|
-
assert_equal('www.facebook.com/dir/test/try/again', Wovnrb::URL.prepend_path('www.facebook.com/test/try/again', 'dir'))
|
73
|
-
end
|
74
|
-
|
75
|
-
def test_prepend_path_no_protocol_no_path
|
76
|
-
assert_equal('www.facebook.com/dir/', Wovnrb::URL.prepend_path('www.facebook.com/', 'dir'))
|
77
|
-
end
|
78
|
-
|
79
|
-
def test_prepend_path_no_protocol_no_path_no_trailing_slash
|
80
|
-
assert_equal('www.facebook.com/dir', Wovnrb::URL.prepend_path('www.facebook.com', 'dir'))
|
81
|
-
end
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
def test_prepend_path_no_protocoli_no_host
|
86
|
-
assert_equal('facebook.com/dir/test/', Wovnrb::URL.prepend_path('facebook.com/test/', 'dir'))
|
87
|
-
end
|
88
|
-
|
89
|
-
def test_prepend_path_no_protocol_no_host_long_path
|
90
|
-
assert_equal('facebook.com/dir/test/try/again/', Wovnrb::URL.prepend_path('facebook.com/test/try/again/', 'dir'))
|
91
|
-
end
|
92
|
-
|
93
|
-
def test_prepend_path_no_protocol_no_host_no_trailing_slash
|
94
|
-
assert_equal('facebook.com/dir/test', Wovnrb::URL.prepend_path('facebook.com/test', 'dir'))
|
95
|
-
end
|
96
|
-
|
97
|
-
def test_prepend_path_no_protocol_no_host_long_path_no_trailing_slash
|
98
|
-
assert_equal('facebook.com/dir/test/try/again', Wovnrb::URL.prepend_path('facebook.com/test/try/again', 'dir'))
|
99
|
-
end
|
100
|
-
|
101
|
-
def test_prepend_path_no_protocol_no_host_no_path
|
102
|
-
assert_equal('facebook.com/dir/', Wovnrb::URL.prepend_path('facebook.com/', 'dir'))
|
103
|
-
end
|
104
|
-
|
105
|
-
def test_prepend_path_no_protocol_no_host_no_path_no_trailing_slash
|
106
|
-
assert_equal('facebook.com/dir', Wovnrb::URL.prepend_path('facebook.com', 'dir'))
|
107
|
-
end
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
def test_prepend_path_no_protocol_with_double_slash
|
112
|
-
assert_equal('//www.yahoo.com/dir/test/', Wovnrb::URL.prepend_path('//www.yahoo.com/test/', 'dir'))
|
113
|
-
end
|
114
|
-
|
115
|
-
def test_prepend_path_no_protocol_long_path_with_double_slash
|
116
|
-
assert_equal('//www.yahoo.com/dir/test/try/again/', Wovnrb::URL.prepend_path('//www.yahoo.com/test/try/again/', 'dir'))
|
117
|
-
end
|
118
|
-
|
119
|
-
def test_prepend_path_no_protocol_no_trailing_slash_with_double_slash
|
120
|
-
assert_equal('//www.yahoo.com/dir/test', Wovnrb::URL.prepend_path('//www.yahoo.com/test', 'dir'))
|
121
|
-
end
|
122
|
-
|
123
|
-
def test_prepend_path_no_protocol_long_path_no_trailing_slash_with_double_slash
|
124
|
-
assert_equal('//www.yahoo.com/dir/test/try/again', Wovnrb::URL.prepend_path('//www.yahoo.com/test/try/again', 'dir'))
|
125
|
-
end
|
126
|
-
|
127
|
-
def test_prepend_path_no_protocol_no_path_with_double_slash
|
128
|
-
assert_equal('//www.yahoo.com/dir/', Wovnrb::URL.prepend_path('//www.yahoo.com/', 'dir'))
|
129
|
-
end
|
130
|
-
|
131
|
-
def test_prepend_path_no_protocol_no_path_no_trailing_slash_with_double_slash
|
132
|
-
assert_equal('//www.yahoo.com/dir', Wovnrb::URL.prepend_path('//www.yahoo.com', 'dir'))
|
133
|
-
end
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
def test_prepend_path_no_protocol_no_host_with_double_slash
|
138
|
-
assert_equal('//yahoo.com/dir/test/', Wovnrb::URL.prepend_path('//yahoo.com/test/', 'dir'))
|
139
|
-
end
|
140
|
-
|
141
|
-
def test_prepend_path_no_protocol_no_host_long_path_with_double_slash
|
142
|
-
assert_equal('//yahoo.com/dir/test/try/again/', Wovnrb::URL.prepend_path('//yahoo.com/test/try/again/', 'dir'))
|
143
|
-
end
|
144
|
-
|
145
|
-
def test_prepend_path_no_protocol_no_host_no_trailing_slash_with_double_slash
|
146
|
-
assert_equal('//yahoo.com/dir/test', Wovnrb::URL.prepend_path('//yahoo.com/test', 'dir'))
|
147
|
-
end
|
148
|
-
|
149
|
-
def test_prepend_path_no_protocol_no_host_long_path_no_trailing_slash_with_double_slash
|
150
|
-
assert_equal('//yahoo.com/dir/test/try/again', Wovnrb::URL.prepend_path('//yahoo.com/test/try/again', 'dir'))
|
151
|
-
end
|
152
|
-
|
153
|
-
def test_prepend_path_no_protocol_no_host_no_path_with_double_slash
|
154
|
-
assert_equal('//yahoo.com/dir/', Wovnrb::URL.prepend_path('//yahoo.com/', 'dir'))
|
155
|
-
end
|
156
|
-
|
157
|
-
def test_prepend_path_no_protocol_no_host_no_path_no_trailing_slash_with_double_slash
|
158
|
-
assert_equal('//yahoo.com/dir', Wovnrb::URL.prepend_path('//yahoo.com', 'dir'))
|
159
|
-
end
|
160
|
-
|
161
|
-
|
162
|
-
|
163
|
-
end
|