wovnrb 0.1.66 → 0.1.67
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/wovnrb/version.rb +1 -1
- data/test/lib/wovnrb_test.rb +160 -160
- data/wovnrb.gemspec +1 -1
- metadata +2 -16
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ee75189bdb68399b7e1334ded4a1c61e84ef7e54
|
4
|
+
data.tar.gz: 4e10a5103074a0e6a98b84cb744df4760d87d97d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ef8fdd670bdd74274d9ef95476847bb09b5874fb18c493759357a53dc96440ca03ad359cd6b0445a34e9ea07de80313175292dfc838a97063af3b2c8ad1fdfdc
|
7
|
+
data.tar.gz: af8175343e889e61d2135feaf018c230442454cc32621c7118e3e98c78443887366be258997f211eaf1c78ec38898a440cd409a1930ce87bcaa91e5383d41e9e
|
data/lib/wovnrb/version.rb
CHANGED
data/test/lib/wovnrb_test.rb
CHANGED
@@ -1,160 +1,160 @@
|
|
1
|
-
require 'wovnrb'
|
2
|
-
require 'wovnrb/headers'
|
3
|
-
require 'minitest/autorun'
|
4
|
-
require 'pry'
|
5
|
-
require 'mocha/mini_test'
|
6
|
-
|
7
|
-
class WovnrbTest < Minitest::Test
|
8
|
-
|
9
|
-
def test_initialize
|
10
|
-
i = Wovnrb::Interceptor.new(get_app)
|
11
|
-
refute_nil(i)
|
12
|
-
end
|
13
|
-
|
14
|
-
# def test_call(env)
|
15
|
-
# end
|
16
|
-
|
17
|
-
# def test_switch_lang(body, values, url, lang=STORE.settings['default_lang'], headers)
|
18
|
-
# end
|
19
|
-
|
20
|
-
# def test_get_langs(values)
|
21
|
-
# end
|
22
|
-
|
23
|
-
def get_app()
|
24
|
-
end
|
25
|
-
|
26
|
-
def test_add_lang_code_nil_href
|
27
|
-
i = Wovnrb::Interceptor.new(get_app)
|
28
|
-
assert_equal(nil, i.add_lang_code(nil,'path', 'en', nil))
|
29
|
-
end
|
30
|
-
def test_add_lang_code_absolute_different_host
|
31
|
-
i = Wovnrb::Interceptor.new(get_app)
|
32
|
-
headers = stub
|
33
|
-
headers.expects(:host).returns('google.com')
|
34
|
-
assert_equal('http://yahoo.co.jp', i.add_lang_code('http://yahoo.co.jp', 'path', 'fr', headers))
|
35
|
-
end
|
36
|
-
|
37
|
-
def test_add_lang_code_absolute_subdomain_no_subdomain
|
38
|
-
i = Wovnrb::Interceptor.new(get_app)
|
39
|
-
headers = stub
|
40
|
-
headers.expects(:host).returns('google.com')
|
41
|
-
assert_equal('http://fr.google.com', i.add_lang_code('http://google.com', 'subdomain', 'fr', headers))
|
42
|
-
end
|
43
|
-
|
44
|
-
def test_add_lang_code_absolute_subdomain_with_subdomain
|
45
|
-
i = Wovnrb::Interceptor.new(get_app)
|
46
|
-
headers = stub
|
47
|
-
headers.expects(:host).returns('home.google.com')
|
48
|
-
assert_equal('http://fr.home.google.com', i.add_lang_code('http://home.google.com', 'subdomain', 'fr', headers))
|
49
|
-
end
|
50
|
-
|
51
|
-
def test_add_lang_code_absolute_query_no_query
|
52
|
-
i = Wovnrb::Interceptor.new(get_app)
|
53
|
-
headers = stub
|
54
|
-
headers.expects(:host).returns('google.com')
|
55
|
-
assert_equal('http://google.com?wovn=fr', i.add_lang_code('http://google.com', 'query', 'fr', headers))
|
56
|
-
end
|
57
|
-
|
58
|
-
def test_add_lang_code_absolute_query_with_query
|
59
|
-
i = Wovnrb::Interceptor.new(get_app)
|
60
|
-
headers = stub
|
61
|
-
headers.expects(:host).returns('google.com')
|
62
|
-
assert_equal('http://google.com?hey=yo&wovn=fr', i.add_lang_code('http://google.com?hey=yo', 'query', 'fr', headers))
|
63
|
-
end
|
64
|
-
|
65
|
-
def test_add_lang_code_absolute_path_no_pathname
|
66
|
-
i = Wovnrb::Interceptor.new(get_app)
|
67
|
-
headers = stub
|
68
|
-
headers.expects(:host).returns('google.com')
|
69
|
-
assert_equal('http://google.com/fr/', i.add_lang_code('http://google.com', 'path', 'fr', headers))
|
70
|
-
end
|
71
|
-
|
72
|
-
def test_add_lang_code_absolute_path_with_pathname
|
73
|
-
i = Wovnrb::Interceptor.new(get_app)
|
74
|
-
headers = stub
|
75
|
-
headers.expects(:host).returns('google.com')
|
76
|
-
assert_equal('http://google.com/fr/index.html', i.add_lang_code('http://google.com/index.html', 'path', 'fr', headers))
|
77
|
-
end
|
78
|
-
|
79
|
-
def test_add_lang_code_absolute_path_with_long_pathname
|
80
|
-
i = Wovnrb::Interceptor.new(get_app)
|
81
|
-
headers = stub
|
82
|
-
headers.expects(:host).returns('google.com')
|
83
|
-
assert_equal('http://google.com/fr/hello/long/path/index.html', i.add_lang_code('http://google.com/hello/long/path/index.html', 'path', 'fr', headers))
|
84
|
-
end
|
85
|
-
|
86
|
-
def test_add_lang_code_relative_subdomain_leading_slash
|
87
|
-
i = Wovnrb::Interceptor.new(get_app)
|
88
|
-
headers = stub
|
89
|
-
headers.expects(:protocol).returns('http')
|
90
|
-
headers.expects(:host).returns('google.com')
|
91
|
-
assert_equal('http://fr.google.com/', i.add_lang_code('/', 'subdomain', 'fr', headers))
|
92
|
-
end
|
93
|
-
|
94
|
-
def test_add_lang_code_relative_subdomain_leading_slash_filename
|
95
|
-
i = Wovnrb::Interceptor.new(get_app)
|
96
|
-
headers = stub
|
97
|
-
headers.expects(:protocol).returns('http')
|
98
|
-
headers.expects(:host).returns('google.com')
|
99
|
-
assert_equal('http://fr.google.com/index.html', i.add_lang_code('/index.html', 'subdomain', 'fr', headers))
|
100
|
-
end
|
101
|
-
|
102
|
-
def test_add_lang_code_relative_subdomain_no_leading_slash_filename
|
103
|
-
i = Wovnrb::Interceptor.new(get_app)
|
104
|
-
headers = stub
|
105
|
-
headers.expects(:protocol).returns('http')
|
106
|
-
headers.expects(:host).returns('google.com')
|
107
|
-
headers.expects(:pathname).returns('/')
|
108
|
-
assert_equal('http://fr.google.com/index.html', i.add_lang_code('index.html', 'subdomain', 'fr', headers))
|
109
|
-
end
|
110
|
-
|
111
|
-
def test_add_lang_code_relative_subdomain_dot_filename
|
112
|
-
i = Wovnrb::Interceptor.new(get_app)
|
113
|
-
headers = stub
|
114
|
-
headers.expects(:protocol).returns('http')
|
115
|
-
headers.expects(:host).returns('google.com')
|
116
|
-
headers.expects(:pathname).returns('/')
|
117
|
-
assert_equal('http://fr.google.com/./index.html', i.add_lang_code('./index.html', 'subdomain', 'fr', headers))
|
118
|
-
end
|
119
|
-
|
120
|
-
def test_add_lang_code_relative_subdomain_two_dots_filename_long_pathname
|
121
|
-
i = Wovnrb::Interceptor.new(get_app)
|
122
|
-
headers = stub
|
123
|
-
headers.expects(:protocol).returns('http')
|
124
|
-
headers.expects(:host).returns('google.com')
|
125
|
-
headers.expects(:pathname).returns('/home/hey/index.html')
|
126
|
-
assert_equal('http://fr.google.com/home/hey/../index.html', i.add_lang_code('../index.html', 'subdomain', 'fr', headers))
|
127
|
-
end
|
128
|
-
|
129
|
-
def test_add_lang_code_relative_query_with_no_query
|
130
|
-
i = Wovnrb::Interceptor.new(get_app)
|
131
|
-
headers = stub
|
132
|
-
assert_equal('/index.html?wovn=fr', i.add_lang_code('/index.html', 'query', 'fr', headers))
|
133
|
-
end
|
134
|
-
|
135
|
-
def test_add_lang_code_relative_query_with_query
|
136
|
-
i = Wovnrb::Interceptor.new(get_app)
|
137
|
-
headers = stub
|
138
|
-
assert_equal('/index.html?hey=yo&wovn=fr', i.add_lang_code('/index.html?hey=yo', 'query', 'fr', headers))
|
139
|
-
end
|
140
|
-
|
141
|
-
def test_add_lang_code_relative_path_with_leading_slash
|
142
|
-
i = Wovnrb::Interceptor.new(get_app)
|
143
|
-
headers = stub
|
144
|
-
assert_equal('/fr/index.html', i.add_lang_code('/index.html', 'path', 'fr', headers))
|
145
|
-
end
|
146
|
-
|
147
|
-
def test_add_lang_code_relative_path_without_leading_slash_different_pathname
|
148
|
-
i = Wovnrb::Interceptor.new(get_app)
|
149
|
-
headers = stub
|
150
|
-
headers.expects(:pathname).returns('/hello/tab.html')
|
151
|
-
assert_equal('/fr/hello/index.html', i.add_lang_code('index.html', 'path', 'fr', headers))
|
152
|
-
end
|
153
|
-
|
154
|
-
def test_add_lang_code_relative_path_without_leading_slash_different_pathname2
|
155
|
-
i = Wovnrb::Interceptor.new(get_app)
|
156
|
-
headers = stub
|
157
|
-
headers.expects(:pathname).returns('/hello/tab.html')
|
158
|
-
assert_equal('/fr/hello/hey/index.html', i.add_lang_code('hey/index.html', 'path', 'fr', headers))
|
159
|
-
end
|
160
|
-
end
|
1
|
+
#require 'wovnrb'
|
2
|
+
#require 'wovnrb/headers'
|
3
|
+
#require 'minitest/autorun'
|
4
|
+
#require 'pry'
|
5
|
+
#require 'mocha/mini_test'
|
6
|
+
#
|
7
|
+
#class WovnrbTest < Minitest::Test
|
8
|
+
#
|
9
|
+
# def test_initialize
|
10
|
+
# i = Wovnrb::Interceptor.new(get_app)
|
11
|
+
# refute_nil(i)
|
12
|
+
# end
|
13
|
+
#
|
14
|
+
# # def test_call(env)
|
15
|
+
# # end
|
16
|
+
#
|
17
|
+
# # def test_switch_lang(body, values, url, lang=STORE.settings['default_lang'], headers)
|
18
|
+
# # end
|
19
|
+
#
|
20
|
+
# # def test_get_langs(values)
|
21
|
+
# # end
|
22
|
+
#
|
23
|
+
# def get_app()
|
24
|
+
# end
|
25
|
+
#
|
26
|
+
# def test_add_lang_code_nil_href
|
27
|
+
# i = Wovnrb::Interceptor.new(get_app)
|
28
|
+
# assert_equal(nil, i.add_lang_code(nil,'path', 'en', nil))
|
29
|
+
# end
|
30
|
+
# def test_add_lang_code_absolute_different_host
|
31
|
+
# i = Wovnrb::Interceptor.new(get_app)
|
32
|
+
# headers = stub
|
33
|
+
# headers.expects(:host).returns('google.com')
|
34
|
+
# assert_equal('http://yahoo.co.jp', i.add_lang_code('http://yahoo.co.jp', 'path', 'fr', headers))
|
35
|
+
# end
|
36
|
+
#
|
37
|
+
# def test_add_lang_code_absolute_subdomain_no_subdomain
|
38
|
+
# i = Wovnrb::Interceptor.new(get_app)
|
39
|
+
# headers = stub
|
40
|
+
# headers.expects(:host).returns('google.com')
|
41
|
+
# assert_equal('http://fr.google.com', i.add_lang_code('http://google.com', 'subdomain', 'fr', headers))
|
42
|
+
# end
|
43
|
+
#
|
44
|
+
# def test_add_lang_code_absolute_subdomain_with_subdomain
|
45
|
+
# i = Wovnrb::Interceptor.new(get_app)
|
46
|
+
# headers = stub
|
47
|
+
# headers.expects(:host).returns('home.google.com')
|
48
|
+
# assert_equal('http://fr.home.google.com', i.add_lang_code('http://home.google.com', 'subdomain', 'fr', headers))
|
49
|
+
# end
|
50
|
+
#
|
51
|
+
# def test_add_lang_code_absolute_query_no_query
|
52
|
+
# i = Wovnrb::Interceptor.new(get_app)
|
53
|
+
# headers = stub
|
54
|
+
# headers.expects(:host).returns('google.com')
|
55
|
+
# assert_equal('http://google.com?wovn=fr', i.add_lang_code('http://google.com', 'query', 'fr', headers))
|
56
|
+
# end
|
57
|
+
#
|
58
|
+
# def test_add_lang_code_absolute_query_with_query
|
59
|
+
# i = Wovnrb::Interceptor.new(get_app)
|
60
|
+
# headers = stub
|
61
|
+
# headers.expects(:host).returns('google.com')
|
62
|
+
# assert_equal('http://google.com?hey=yo&wovn=fr', i.add_lang_code('http://google.com?hey=yo', 'query', 'fr', headers))
|
63
|
+
# end
|
64
|
+
#
|
65
|
+
# def test_add_lang_code_absolute_path_no_pathname
|
66
|
+
# i = Wovnrb::Interceptor.new(get_app)
|
67
|
+
# headers = stub
|
68
|
+
# headers.expects(:host).returns('google.com')
|
69
|
+
# assert_equal('http://google.com/fr/', i.add_lang_code('http://google.com', 'path', 'fr', headers))
|
70
|
+
# end
|
71
|
+
#
|
72
|
+
# def test_add_lang_code_absolute_path_with_pathname
|
73
|
+
# i = Wovnrb::Interceptor.new(get_app)
|
74
|
+
# headers = stub
|
75
|
+
# headers.expects(:host).returns('google.com')
|
76
|
+
# assert_equal('http://google.com/fr/index.html', i.add_lang_code('http://google.com/index.html', 'path', 'fr', headers))
|
77
|
+
# end
|
78
|
+
#
|
79
|
+
# def test_add_lang_code_absolute_path_with_long_pathname
|
80
|
+
# i = Wovnrb::Interceptor.new(get_app)
|
81
|
+
# headers = stub
|
82
|
+
# headers.expects(:host).returns('google.com')
|
83
|
+
# assert_equal('http://google.com/fr/hello/long/path/index.html', i.add_lang_code('http://google.com/hello/long/path/index.html', 'path', 'fr', headers))
|
84
|
+
# end
|
85
|
+
#
|
86
|
+
# def test_add_lang_code_relative_subdomain_leading_slash
|
87
|
+
# i = Wovnrb::Interceptor.new(get_app)
|
88
|
+
# headers = stub
|
89
|
+
# headers.expects(:protocol).returns('http')
|
90
|
+
# headers.expects(:host).returns('google.com')
|
91
|
+
# assert_equal('http://fr.google.com/', i.add_lang_code('/', 'subdomain', 'fr', headers))
|
92
|
+
# end
|
93
|
+
#
|
94
|
+
# def test_add_lang_code_relative_subdomain_leading_slash_filename
|
95
|
+
# i = Wovnrb::Interceptor.new(get_app)
|
96
|
+
# headers = stub
|
97
|
+
# headers.expects(:protocol).returns('http')
|
98
|
+
# headers.expects(:host).returns('google.com')
|
99
|
+
# assert_equal('http://fr.google.com/index.html', i.add_lang_code('/index.html', 'subdomain', 'fr', headers))
|
100
|
+
# end
|
101
|
+
#
|
102
|
+
# def test_add_lang_code_relative_subdomain_no_leading_slash_filename
|
103
|
+
# i = Wovnrb::Interceptor.new(get_app)
|
104
|
+
# headers = stub
|
105
|
+
# headers.expects(:protocol).returns('http')
|
106
|
+
# headers.expects(:host).returns('google.com')
|
107
|
+
# headers.expects(:pathname).returns('/')
|
108
|
+
# assert_equal('http://fr.google.com/index.html', i.add_lang_code('index.html', 'subdomain', 'fr', headers))
|
109
|
+
# end
|
110
|
+
#
|
111
|
+
# def test_add_lang_code_relative_subdomain_dot_filename
|
112
|
+
# i = Wovnrb::Interceptor.new(get_app)
|
113
|
+
# headers = stub
|
114
|
+
# headers.expects(:protocol).returns('http')
|
115
|
+
# headers.expects(:host).returns('google.com')
|
116
|
+
# headers.expects(:pathname).returns('/')
|
117
|
+
# assert_equal('http://fr.google.com/./index.html', i.add_lang_code('./index.html', 'subdomain', 'fr', headers))
|
118
|
+
# end
|
119
|
+
#
|
120
|
+
# def test_add_lang_code_relative_subdomain_two_dots_filename_long_pathname
|
121
|
+
# i = Wovnrb::Interceptor.new(get_app)
|
122
|
+
# headers = stub
|
123
|
+
# headers.expects(:protocol).returns('http')
|
124
|
+
# headers.expects(:host).returns('google.com')
|
125
|
+
# headers.expects(:pathname).returns('/home/hey/index.html')
|
126
|
+
# assert_equal('http://fr.google.com/home/hey/../index.html', i.add_lang_code('../index.html', 'subdomain', 'fr', headers))
|
127
|
+
# end
|
128
|
+
#
|
129
|
+
# def test_add_lang_code_relative_query_with_no_query
|
130
|
+
# i = Wovnrb::Interceptor.new(get_app)
|
131
|
+
# headers = stub
|
132
|
+
# assert_equal('/index.html?wovn=fr', i.add_lang_code('/index.html', 'query', 'fr', headers))
|
133
|
+
# end
|
134
|
+
#
|
135
|
+
# def test_add_lang_code_relative_query_with_query
|
136
|
+
# i = Wovnrb::Interceptor.new(get_app)
|
137
|
+
# headers = stub
|
138
|
+
# assert_equal('/index.html?hey=yo&wovn=fr', i.add_lang_code('/index.html?hey=yo', 'query', 'fr', headers))
|
139
|
+
# end
|
140
|
+
#
|
141
|
+
# def test_add_lang_code_relative_path_with_leading_slash
|
142
|
+
# i = Wovnrb::Interceptor.new(get_app)
|
143
|
+
# headers = stub
|
144
|
+
# assert_equal('/fr/index.html', i.add_lang_code('/index.html', 'path', 'fr', headers))
|
145
|
+
# end
|
146
|
+
#
|
147
|
+
# def test_add_lang_code_relative_path_without_leading_slash_different_pathname
|
148
|
+
# i = Wovnrb::Interceptor.new(get_app)
|
149
|
+
# headers = stub
|
150
|
+
# headers.expects(:pathname).returns('/hello/tab.html')
|
151
|
+
# assert_equal('/fr/hello/index.html', i.add_lang_code('index.html', 'path', 'fr', headers))
|
152
|
+
# end
|
153
|
+
#
|
154
|
+
# def test_add_lang_code_relative_path_without_leading_slash_different_pathname2
|
155
|
+
# i = Wovnrb::Interceptor.new(get_app)
|
156
|
+
# headers = stub
|
157
|
+
# headers.expects(:pathname).returns('/hello/tab.html')
|
158
|
+
# assert_equal('/fr/hello/hey/index.html', i.add_lang_code('hey/index.html', 'path', 'fr', headers))
|
159
|
+
# end
|
160
|
+
#end
|
data/wovnrb.gemspec
CHANGED
@@ -30,7 +30,7 @@ Gem::Specification.new do |spec|
|
|
30
30
|
|
31
31
|
spec.add_development_dependency "bundler", "~> 1.7"
|
32
32
|
spec.add_development_dependency "rake", "~> 10.0"
|
33
|
-
spec.add_development_dependency "mocha"
|
33
|
+
##spec.add_development_dependency "mocha"
|
34
34
|
#spec.add_development_dependency "rspec"
|
35
35
|
#spec.add_development_dependency "rspec-nc"
|
36
36
|
spec.add_development_dependency "test-unit"
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: wovnrb
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.67
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jeff Sandford
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2015-10-
|
12
|
+
date: 2015-10-27 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: nokogumbo
|
@@ -67,20 +67,6 @@ dependencies:
|
|
67
67
|
- - ~>
|
68
68
|
- !ruby/object:Gem::Version
|
69
69
|
version: '10.0'
|
70
|
-
- !ruby/object:Gem::Dependency
|
71
|
-
name: mocha
|
72
|
-
requirement: !ruby/object:Gem::Requirement
|
73
|
-
requirements:
|
74
|
-
- - '>='
|
75
|
-
- !ruby/object:Gem::Version
|
76
|
-
version: '0'
|
77
|
-
type: :development
|
78
|
-
prerelease: false
|
79
|
-
version_requirements: !ruby/object:Gem::Requirement
|
80
|
-
requirements:
|
81
|
-
- - '>='
|
82
|
-
- !ruby/object:Gem::Version
|
83
|
-
version: '0'
|
84
70
|
- !ruby/object:Gem::Dependency
|
85
71
|
name: test-unit
|
86
72
|
requirement: !ruby/object:Gem::Requirement
|