browser 1.0.1 → 1.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +12 -4
- data/Rakefile +1 -1
- data/bots.yml +79 -22
- data/browser.gemspec +5 -0
- data/languages.yml +0 -1
- data/lib/browser.rb +37 -7
- data/lib/browser/meta/proxy.rb +9 -0
- data/lib/browser/methods/blackberry.rb +51 -0
- data/lib/browser/methods/ie.rb +14 -8
- data/lib/browser/methods/mobile.rb +5 -5
- data/lib/browser/methods/platform.rb +39 -33
- data/lib/browser/methods/proxy.rb +8 -0
- data/lib/browser/methods/tv.rb +1 -1
- data/lib/browser/version.rb +2 -2
- data/test/browser_test.rb +248 -0
- data/test/{middleware_spec.rb → middleware_test.rb} +8 -8
- data/test/sample_app.rb +3 -3
- data/test/test_helper.rb +20 -0
- data/test/ua.yml +35 -10
- data/test/unit/adobe_air_test.rb +17 -0
- data/test/unit/android_test.rb +97 -0
- data/test/unit/blackberry_test.rb +106 -0
- data/test/unit/bots_test.rb +121 -0
- data/test/unit/chrome_test.rb +60 -0
- data/test/unit/console_test.rb +71 -0
- data/test/unit/firefox_test.rb +41 -0
- data/test/unit/ie_test.rb +379 -0
- data/test/unit/ios_app_test.rb +17 -0
- data/test/unit/ios_test.rb +143 -0
- data/test/unit/kindle_test.rb +41 -0
- data/test/unit/nokia_test.rb +13 -0
- data/test/unit/opera_test.rb +46 -0
- data/test/unit/proxy_test.rb +18 -0
- data/test/unit/uc_browser_test.rb +13 -0
- data/test/unit/windows_phone_test.rb +54 -0
- data/test/unit/windows_test.rb +64 -0
- metadata +77 -9
- data/test/browser_spec.rb +0 -1141
- data/test/spec_helper.rb +0 -8
@@ -0,0 +1,60 @@
|
|
1
|
+
require "test_helper"
|
2
|
+
|
3
|
+
class ChromeTest < Minitest::Test
|
4
|
+
setup do
|
5
|
+
@browser = Browser.new
|
6
|
+
end
|
7
|
+
|
8
|
+
test "detects chrome" do
|
9
|
+
@browser.ua = $ua["CHROME"]
|
10
|
+
|
11
|
+
assert_equal "Chrome", @browser.name
|
12
|
+
assert @browser.chrome?
|
13
|
+
refute @browser.safari?
|
14
|
+
assert @browser.webkit?
|
15
|
+
assert @browser.modern?
|
16
|
+
assert_equal "5.0.375.99", @browser.full_version
|
17
|
+
assert_equal "5", @browser.version
|
18
|
+
end
|
19
|
+
|
20
|
+
test "detects mobile chrome" do
|
21
|
+
@browser.ua = $ua["MOBILE_CHROME"]
|
22
|
+
|
23
|
+
assert_equal "Chrome", @browser.name
|
24
|
+
assert @browser.chrome?
|
25
|
+
refute @browser.safari?
|
26
|
+
assert @browser.webkit?
|
27
|
+
assert @browser.modern?
|
28
|
+
assert_equal "19.0.1084.60", @browser.full_version
|
29
|
+
assert_equal "19", @browser.version
|
30
|
+
end
|
31
|
+
|
32
|
+
test "detects samsung chrome" do
|
33
|
+
@browser.ua = $ua["SAMSUNG_CHROME"]
|
34
|
+
|
35
|
+
assert_equal "Chrome", @browser.name
|
36
|
+
assert @browser.chrome?
|
37
|
+
assert @browser.android?
|
38
|
+
refute @browser.safari?
|
39
|
+
assert @browser.webkit?
|
40
|
+
assert @browser.modern?
|
41
|
+
assert_equal "28.0.1500.94", @browser.full_version
|
42
|
+
assert_equal "28", @browser.version
|
43
|
+
end
|
44
|
+
|
45
|
+
test "detects chrome os" do
|
46
|
+
@browser.ua = $ua["CHROME_OS"]
|
47
|
+
assert @browser.chrome_os?
|
48
|
+
end
|
49
|
+
|
50
|
+
test "detects yandex browser" do
|
51
|
+
@browser.ua = $ua["YANDEX_BROWSER"]
|
52
|
+
|
53
|
+
assert @browser.yandex?
|
54
|
+
assert @browser.chrome?
|
55
|
+
refute @browser.safari?
|
56
|
+
assert @browser.webkit?
|
57
|
+
assert_equal "41.0.2272.118", @browser.full_version
|
58
|
+
assert_equal "41", @browser.version
|
59
|
+
end
|
60
|
+
end
|
@@ -0,0 +1,71 @@
|
|
1
|
+
require "test_helper"
|
2
|
+
|
3
|
+
class ConsoleTest < Minitest::Test
|
4
|
+
setup do
|
5
|
+
@browser = Browser.new
|
6
|
+
end
|
7
|
+
|
8
|
+
test "detects nintendo wii" do
|
9
|
+
@browser.ua = $ua["NINTENDO_WII"]
|
10
|
+
|
11
|
+
assert @browser.console?
|
12
|
+
assert @browser.nintendo?
|
13
|
+
end
|
14
|
+
|
15
|
+
test "detects nintendo wii u" do
|
16
|
+
@browser.ua = $ua["NINTENDO_WIIU"]
|
17
|
+
|
18
|
+
assert @browser.console?
|
19
|
+
assert @browser.nintendo?
|
20
|
+
end
|
21
|
+
|
22
|
+
test "detects playstation 3" do
|
23
|
+
@browser.ua = $ua["PLAYSTATION3"]
|
24
|
+
|
25
|
+
assert @browser.console?
|
26
|
+
assert @browser.playstation?
|
27
|
+
refute @browser.playstation4?
|
28
|
+
end
|
29
|
+
|
30
|
+
test "detects playstation 4" do
|
31
|
+
@browser.ua = $ua["PLAYSTATION4"]
|
32
|
+
|
33
|
+
assert @browser.console?
|
34
|
+
assert @browser.playstation?
|
35
|
+
assert @browser.playstation4?
|
36
|
+
end
|
37
|
+
|
38
|
+
test "detects xbox 360" do
|
39
|
+
@browser.ua = $ua["XBOX360"]
|
40
|
+
|
41
|
+
assert @browser.console?
|
42
|
+
assert @browser.xbox?
|
43
|
+
refute @browser.xbox_one?
|
44
|
+
end
|
45
|
+
|
46
|
+
test "detects xbox one" do
|
47
|
+
@browser.ua = $ua["XBOXONE"]
|
48
|
+
|
49
|
+
assert @browser.console?
|
50
|
+
assert @browser.xbox?
|
51
|
+
assert @browser.xbox_one?
|
52
|
+
end
|
53
|
+
|
54
|
+
test "detects psp" do
|
55
|
+
@browser.ua = $ua["PSP"]
|
56
|
+
|
57
|
+
assert_equal "PlayStation Portable", @browser.name
|
58
|
+
assert @browser.psp?
|
59
|
+
refute @browser.psp_vita?
|
60
|
+
assert @browser.mobile?
|
61
|
+
end
|
62
|
+
|
63
|
+
test "detects psp vita" do
|
64
|
+
@browser.ua = $ua["PSP_VITA"]
|
65
|
+
|
66
|
+
assert_equal "PlayStation Portable", @browser.name
|
67
|
+
assert @browser.psp?
|
68
|
+
assert @browser.psp_vita?
|
69
|
+
assert @browser.mobile?
|
70
|
+
end
|
71
|
+
end
|
@@ -0,0 +1,41 @@
|
|
1
|
+
require "test_helper"
|
2
|
+
|
3
|
+
class FirefoxTest < Minitest::Test
|
4
|
+
setup do
|
5
|
+
@browser = Browser.new
|
6
|
+
end
|
7
|
+
|
8
|
+
test "detects firefox" do
|
9
|
+
@browser.ua = $ua["FIREFOX"]
|
10
|
+
|
11
|
+
assert_equal "Firefox", @browser.name
|
12
|
+
assert @browser.firefox?
|
13
|
+
refute @browser.modern?
|
14
|
+
assert_equal "3.8", @browser.full_version
|
15
|
+
assert_equal "3", @browser.version
|
16
|
+
end
|
17
|
+
|
18
|
+
test "detects modern firefox" do
|
19
|
+
@browser.ua = $ua["FIREFOX_MODERN"]
|
20
|
+
|
21
|
+
assert_equal :firefox, @browser.id
|
22
|
+
assert_equal "Firefox", @browser.name
|
23
|
+
assert @browser.firefox?
|
24
|
+
assert @browser.modern?
|
25
|
+
assert_equal "17.0", @browser.full_version
|
26
|
+
assert_equal "17", @browser.version
|
27
|
+
end
|
28
|
+
|
29
|
+
test "detects firefox android tablet" do
|
30
|
+
@browser.ua = $ua["FIREFOX_TABLET"]
|
31
|
+
|
32
|
+
assert_equal :firefox, @browser.id
|
33
|
+
assert_equal "Firefox", @browser.name
|
34
|
+
assert @browser.firefox?
|
35
|
+
assert @browser.modern?
|
36
|
+
assert @browser.tablet?
|
37
|
+
assert @browser.android?
|
38
|
+
assert_equal "14.0", @browser.full_version
|
39
|
+
assert_equal "14", @browser.version
|
40
|
+
end
|
41
|
+
end
|
@@ -0,0 +1,379 @@
|
|
1
|
+
require "test_helper"
|
2
|
+
|
3
|
+
class IeTest < Minitest::Test
|
4
|
+
setup do
|
5
|
+
@browser = Browser.new
|
6
|
+
end
|
7
|
+
|
8
|
+
test "detects ie6" do
|
9
|
+
@browser.ua = $ua["IE6"]
|
10
|
+
|
11
|
+
assert_equal "Internet Explorer", @browser.name
|
12
|
+
assert @browser.ie?
|
13
|
+
assert @browser.ie?(6)
|
14
|
+
refute @browser.modern?
|
15
|
+
assert_equal "6.0", @browser.full_version
|
16
|
+
assert_equal "6", @browser.version
|
17
|
+
end
|
18
|
+
|
19
|
+
test "detects ie7" do
|
20
|
+
@browser.ua = $ua["IE7"]
|
21
|
+
|
22
|
+
assert_equal "Internet Explorer", @browser.name
|
23
|
+
assert @browser.ie?
|
24
|
+
assert @browser.ie?(7)
|
25
|
+
refute @browser.modern?
|
26
|
+
assert_equal "7.0", @browser.full_version
|
27
|
+
assert_equal "7", @browser.version
|
28
|
+
end
|
29
|
+
|
30
|
+
test "detects ie8" do
|
31
|
+
@browser.ua = $ua["IE8"]
|
32
|
+
|
33
|
+
assert_equal "Internet Explorer", @browser.name
|
34
|
+
assert @browser.ie?
|
35
|
+
assert @browser.ie?(8)
|
36
|
+
refute @browser.modern?
|
37
|
+
refute @browser.compatibility_view?
|
38
|
+
assert_equal "8.0", @browser.full_version
|
39
|
+
assert_equal "8", @browser.version
|
40
|
+
end
|
41
|
+
|
42
|
+
test "detects ie8 in compatibility view" do
|
43
|
+
@browser.ua = $ua["IE8_COMPAT"]
|
44
|
+
|
45
|
+
assert_equal "Internet Explorer", @browser.name
|
46
|
+
assert @browser.ie?
|
47
|
+
assert @browser.ie?(8)
|
48
|
+
refute @browser.modern?
|
49
|
+
assert @browser.compatibility_view?
|
50
|
+
assert_equal "8.0", @browser.full_version
|
51
|
+
assert_equal "8", @browser.version
|
52
|
+
assert_equal "7.0", @browser.msie_full_version
|
53
|
+
assert_equal "7", @browser.msie_version
|
54
|
+
end
|
55
|
+
|
56
|
+
test "detects ie9" do
|
57
|
+
@browser.ua = $ua["IE9"]
|
58
|
+
|
59
|
+
assert_equal "Internet Explorer", @browser.name
|
60
|
+
assert @browser.ie?
|
61
|
+
assert @browser.ie?(9)
|
62
|
+
assert @browser.modern?
|
63
|
+
refute @browser.compatibility_view?
|
64
|
+
assert_equal "9.0", @browser.full_version
|
65
|
+
assert_equal "9", @browser.version
|
66
|
+
end
|
67
|
+
|
68
|
+
test "detects ie9 in compatibility view" do
|
69
|
+
@browser.ua = $ua["IE9_COMPAT"]
|
70
|
+
|
71
|
+
assert_equal "Internet Explorer", @browser.name
|
72
|
+
assert @browser.ie?
|
73
|
+
assert @browser.ie?(9)
|
74
|
+
refute @browser.modern?
|
75
|
+
assert @browser.compatibility_view?
|
76
|
+
assert_equal "9.0", @browser.full_version
|
77
|
+
assert_equal "9", @browser.version
|
78
|
+
assert_equal "7.0", @browser.msie_full_version
|
79
|
+
assert_equal "7", @browser.msie_version
|
80
|
+
end
|
81
|
+
|
82
|
+
test "detects ie10" do
|
83
|
+
@browser.ua = $ua["IE10"]
|
84
|
+
|
85
|
+
assert_equal "Internet Explorer", @browser.name
|
86
|
+
assert @browser.ie?
|
87
|
+
assert @browser.ie?(10)
|
88
|
+
assert @browser.modern?
|
89
|
+
refute @browser.compatibility_view?
|
90
|
+
assert_equal "10.0", @browser.full_version
|
91
|
+
assert_equal "10", @browser.version
|
92
|
+
end
|
93
|
+
|
94
|
+
test "detects ie10 in compatibility view" do
|
95
|
+
@browser.ua = $ua["IE10_COMPAT"]
|
96
|
+
|
97
|
+
assert_equal "Internet Explorer", @browser.name
|
98
|
+
assert @browser.ie?
|
99
|
+
assert @browser.ie?(10)
|
100
|
+
refute @browser.modern?
|
101
|
+
assert @browser.compatibility_view?
|
102
|
+
assert_equal "10.0", @browser.full_version
|
103
|
+
assert_equal "10", @browser.version
|
104
|
+
assert_equal "7.0", @browser.msie_full_version
|
105
|
+
assert_equal "7", @browser.msie_version
|
106
|
+
end
|
107
|
+
|
108
|
+
test "detects ie11" do
|
109
|
+
@browser.ua = $ua["IE11"]
|
110
|
+
|
111
|
+
assert_equal "Internet Explorer", @browser.name
|
112
|
+
assert @browser.ie?
|
113
|
+
assert @browser.ie?(11)
|
114
|
+
assert @browser.modern?
|
115
|
+
refute @browser.compatibility_view?
|
116
|
+
assert_equal "11.0", @browser.full_version
|
117
|
+
assert_equal "11", @browser.version
|
118
|
+
end
|
119
|
+
|
120
|
+
test "detects ie11 in compatibility view" do
|
121
|
+
@browser.ua = $ua["IE11_COMPAT"]
|
122
|
+
|
123
|
+
assert_equal "Internet Explorer", @browser.name
|
124
|
+
assert @browser.ie?
|
125
|
+
assert @browser.ie?(11)
|
126
|
+
refute @browser.modern?
|
127
|
+
assert @browser.compatibility_view?
|
128
|
+
assert_equal "11.0", @browser.full_version
|
129
|
+
assert_equal "11", @browser.version
|
130
|
+
assert_equal "7.0", @browser.msie_full_version
|
131
|
+
assert_equal "7", @browser.msie_version
|
132
|
+
end
|
133
|
+
|
134
|
+
test "detects Lumia 800" do
|
135
|
+
@browser.ua = $ua["LUMIA800"]
|
136
|
+
|
137
|
+
assert_equal "Internet Explorer", @browser.name
|
138
|
+
assert @browser.ie?
|
139
|
+
assert @browser.ie?(9)
|
140
|
+
assert_equal "9.0", @browser.full_version
|
141
|
+
assert_equal "9", @browser.version
|
142
|
+
refute @browser.tablet?
|
143
|
+
assert @browser.mobile?
|
144
|
+
end
|
145
|
+
|
146
|
+
test "detects ie11 touch desktop pc" do
|
147
|
+
@browser.ua = $ua["IE11_TOUCH_SCREEN"]
|
148
|
+
|
149
|
+
assert_equal "Internet Explorer", @browser.name
|
150
|
+
assert @browser.ie?
|
151
|
+
assert @browser.ie?(11)
|
152
|
+
assert @browser.modern?
|
153
|
+
refute @browser.compatibility_view?
|
154
|
+
refute @browser.windows_rt?
|
155
|
+
assert @browser.windows_touchscreen_desktop?
|
156
|
+
assert @browser.windows8?
|
157
|
+
assert_equal "11.0", @browser.full_version
|
158
|
+
assert_equal "11", @browser.version
|
159
|
+
end
|
160
|
+
|
161
|
+
test "detects Microsoft Edge" do
|
162
|
+
@browser.ua = $ua["MS_EDGE"]
|
163
|
+
|
164
|
+
assert_equal :edge, @browser.id
|
165
|
+
assert_equal "Microsoft Edge", @browser.name
|
166
|
+
assert_equal "12.0", @browser.full_version
|
167
|
+
assert_equal "12", @browser.version
|
168
|
+
assert @browser.windows10?
|
169
|
+
assert @browser.edge?
|
170
|
+
assert @browser.modern?
|
171
|
+
refute @browser.webkit?
|
172
|
+
refute @browser.chrome?
|
173
|
+
refute @browser.safari?
|
174
|
+
refute @browser.mobile?
|
175
|
+
end
|
176
|
+
|
177
|
+
test "detects Microsoft Edge in compatibility view" do
|
178
|
+
@browser.ua = $ua["MS_EDGE_COMPAT"]
|
179
|
+
|
180
|
+
assert_equal :edge, @browser.id
|
181
|
+
assert_equal "Microsoft Edge", @browser.name
|
182
|
+
assert_equal "12.0", @browser.full_version
|
183
|
+
assert_equal "12", @browser.version
|
184
|
+
assert_equal "7.0", @browser.msie_full_version
|
185
|
+
assert_equal "7", @browser.msie_version
|
186
|
+
assert @browser.edge?
|
187
|
+
assert @browser.compatibility_view?
|
188
|
+
refute @browser.modern?
|
189
|
+
refute @browser.webkit?
|
190
|
+
refute @browser.chrome?
|
191
|
+
refute @browser.safari?
|
192
|
+
refute @browser.mobile?
|
193
|
+
end
|
194
|
+
|
195
|
+
test "detects Microsoft Edge Mobile" do
|
196
|
+
@browser.ua = $ua["MS_EDGE_MOBILE"]
|
197
|
+
|
198
|
+
assert_equal :edge, @browser.id
|
199
|
+
assert_equal "Microsoft Edge", @browser.name
|
200
|
+
assert_equal "12.0", @browser.full_version
|
201
|
+
assert_equal "12", @browser.version
|
202
|
+
refute @browser.windows10?
|
203
|
+
assert @browser.windows_phone?
|
204
|
+
assert @browser.edge?
|
205
|
+
assert @browser.modern?
|
206
|
+
assert @browser.mobile?
|
207
|
+
refute @browser.webkit?
|
208
|
+
refute @browser.chrome?
|
209
|
+
refute @browser.safari?
|
210
|
+
end
|
211
|
+
|
212
|
+
test "detects IE without Trident" do
|
213
|
+
@browser.ua = $ua["IE_WITHOUT_TRIDENT"]
|
214
|
+
|
215
|
+
assert_equal :ie, @browser.id
|
216
|
+
assert_equal "Internet Explorer", @browser.name
|
217
|
+
assert_equal "0.0", @browser.msie_full_version
|
218
|
+
assert_equal "0", @browser.msie_version
|
219
|
+
assert_equal "0.0", @browser.full_version
|
220
|
+
assert_equal "0", @browser.version
|
221
|
+
refute @browser.windows10?
|
222
|
+
refute @browser.windows_phone?
|
223
|
+
refute @browser.edge?
|
224
|
+
refute @browser.modern?
|
225
|
+
refute @browser.mobile?
|
226
|
+
refute @browser.webkit?
|
227
|
+
refute @browser.chrome?
|
228
|
+
refute @browser.safari?
|
229
|
+
end
|
230
|
+
|
231
|
+
test "detects windows phone" do
|
232
|
+
@browser.ua = $ua["WINDOWS_PHONE"]
|
233
|
+
|
234
|
+
assert @browser.ie?
|
235
|
+
assert_equal "7", @browser.version
|
236
|
+
assert @browser.mobile?
|
237
|
+
assert @browser.windows_phone?
|
238
|
+
refute @browser.windows_mobile?
|
239
|
+
refute @browser.tablet?
|
240
|
+
end
|
241
|
+
|
242
|
+
test "detects windows phone 8" do
|
243
|
+
@browser.ua = $ua["WINDOWS_PHONE8"]
|
244
|
+
|
245
|
+
assert @browser.ie?
|
246
|
+
assert_equal "10", @browser.version
|
247
|
+
assert @browser.mobile?
|
248
|
+
assert @browser.windows_phone?
|
249
|
+
refute @browser.windows_mobile?
|
250
|
+
refute @browser.tablet?
|
251
|
+
end
|
252
|
+
|
253
|
+
test "detects windows phone 8.1" do
|
254
|
+
@browser.ua = $ua["WINDOWS_PHONE_81"]
|
255
|
+
|
256
|
+
assert @browser.ie?
|
257
|
+
assert_equal "Internet Explorer", @browser.name
|
258
|
+
assert_equal :ie, @browser.id
|
259
|
+
assert_equal "11", @browser.version
|
260
|
+
assert_equal "11.0", @browser.full_version
|
261
|
+
assert @browser.mobile?
|
262
|
+
assert @browser.windows_phone?
|
263
|
+
refute @browser.windows_mobile?
|
264
|
+
refute @browser.tablet?
|
265
|
+
end
|
266
|
+
|
267
|
+
test "detects windows mobile (windows phone 8)" do
|
268
|
+
@browser.ua = $ua["WINDOWS_PHONE8"]
|
269
|
+
|
270
|
+
assert @browser.ie?
|
271
|
+
assert_equal "10", @browser.version
|
272
|
+
assert @browser.mobile?
|
273
|
+
assert @browser.windows_phone?
|
274
|
+
refute @browser.windows_mobile?
|
275
|
+
refute @browser.tablet?
|
276
|
+
end
|
277
|
+
|
278
|
+
test "detects windows x64" do
|
279
|
+
@browser.ua = $ua["IE10_X64_WINX64"]
|
280
|
+
assert @browser.windows_x64?
|
281
|
+
refute @browser.windows_wow64?
|
282
|
+
assert @browser.windows_x64_inclusive?
|
283
|
+
end
|
284
|
+
|
285
|
+
test "detects windows wow64" do
|
286
|
+
@browser.ua = $ua["WINDOWS_WOW64"]
|
287
|
+
refute @browser.windows_x64?
|
288
|
+
assert @browser.windows_wow64?
|
289
|
+
assert @browser.windows_x64_inclusive?
|
290
|
+
end
|
291
|
+
|
292
|
+
test "detects windows platform" do
|
293
|
+
@browser.ua = "Windows"
|
294
|
+
assert_equal :windows, @browser.platform
|
295
|
+
assert @browser.windows?
|
296
|
+
end
|
297
|
+
|
298
|
+
test "detects windows_xp" do
|
299
|
+
@browser.ua = $ua["WINDOWS_XP"]
|
300
|
+
|
301
|
+
assert @browser.windows?
|
302
|
+
assert @browser.windows_xp?
|
303
|
+
end
|
304
|
+
|
305
|
+
test "detects windows_vista" do
|
306
|
+
@browser.ua = $ua["WINDOWS_VISTA"]
|
307
|
+
|
308
|
+
assert @browser.windows?
|
309
|
+
assert @browser.windows_vista?
|
310
|
+
end
|
311
|
+
|
312
|
+
test "detects windows7" do
|
313
|
+
@browser.ua = $ua["WINDOWS7"]
|
314
|
+
|
315
|
+
assert @browser.windows?
|
316
|
+
assert @browser.windows7?
|
317
|
+
end
|
318
|
+
|
319
|
+
test "detects windows8" do
|
320
|
+
@browser.ua = $ua["WINDOWS8"]
|
321
|
+
|
322
|
+
assert @browser.windows?
|
323
|
+
assert @browser.windows8?
|
324
|
+
refute @browser.windows8_1?
|
325
|
+
end
|
326
|
+
|
327
|
+
test "detects windows8.1" do
|
328
|
+
@browser.ua = $ua["WINDOWS81"]
|
329
|
+
|
330
|
+
assert @browser.windows?
|
331
|
+
assert @browser.windows8?
|
332
|
+
assert @browser.windows8_1?
|
333
|
+
end
|
334
|
+
|
335
|
+
test "returns string representation for ie6" do
|
336
|
+
@browser.ua = $ua["IE6"]
|
337
|
+
meta = @browser.meta
|
338
|
+
|
339
|
+
assert meta.include?("ie")
|
340
|
+
assert meta.include?("ie6")
|
341
|
+
assert meta.include?("oldie")
|
342
|
+
assert meta.include?("lt-ie8")
|
343
|
+
assert meta.include?("lt-ie9")
|
344
|
+
assert meta.include?("windows")
|
345
|
+
end
|
346
|
+
|
347
|
+
test "returns string representation for ie7" do
|
348
|
+
@browser.ua = $ua["IE7"]
|
349
|
+
meta = @browser.meta
|
350
|
+
|
351
|
+
assert meta.include?("ie")
|
352
|
+
assert meta.include?("ie7")
|
353
|
+
assert meta.include?("oldie")
|
354
|
+
assert meta.include?("lt-ie8")
|
355
|
+
assert meta.include?("lt-ie9")
|
356
|
+
assert meta.include?("windows")
|
357
|
+
end
|
358
|
+
|
359
|
+
test "returns string representation for ie8" do
|
360
|
+
@browser.ua = $ua["IE8"]
|
361
|
+
meta = @browser.meta
|
362
|
+
|
363
|
+
assert meta.include?("ie")
|
364
|
+
assert meta.include?("ie8")
|
365
|
+
assert meta.include?("lt-ie9")
|
366
|
+
assert meta.include?("windows")
|
367
|
+
end
|
368
|
+
|
369
|
+
test "warn about deprecated numbered version" do
|
370
|
+
message = "Browser#ie6? is deprecated; use Browser#ie?(version) instead"
|
371
|
+
assert_deprecated(message, __FILE__, __LINE__) { @browser.ie6? }
|
372
|
+
end
|
373
|
+
|
374
|
+
test "don't detect as two different versions" do
|
375
|
+
@browser.ua = $ua["IE8"]
|
376
|
+
assert @browser.ie?(8)
|
377
|
+
refute @browser.ie?(7)
|
378
|
+
end
|
379
|
+
end
|