browser 5.3.1 → 6.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (50) hide show
  1. checksums.yaml +4 -4
  2. data/{FUNDING.yml → .github/FUNDING.yml} +2 -1
  3. data/.github/workflows/{tests.yml → ruby-tests.yml} +17 -17
  4. data/.rubocop.yml +3 -23
  5. data/CHANGELOG.md +6 -0
  6. data/LICENSE.md +20 -0
  7. data/README.md +10 -3
  8. data/browser.gemspec +4 -5
  9. data/gemfiles/{rails6_0.gemfile → 7_0.gemfile} +1 -1
  10. data/gemfiles/{rails6_1.gemfile → 7_1.gemfile} +1 -1
  11. data/lib/browser/accept_language.rb +1 -1
  12. data/lib/browser/base.rb +34 -29
  13. data/lib/browser/browser.rb +4 -3
  14. data/lib/browser/chrome.rb +4 -0
  15. data/lib/browser/device.rb +9 -9
  16. data/lib/browser/edge.rb +1 -1
  17. data/lib/browser/meta/base.rb +1 -1
  18. data/lib/browser/platform.rb +1 -1
  19. data/lib/browser/testing.rb +3 -3
  20. data/lib/browser/version.rb +1 -1
  21. data/lib/browser.rb +1 -1
  22. data/search_engines.yml +1 -0
  23. data/test/browser_test.rb +3 -3
  24. data/test/rails_test.rb +1 -1
  25. data/test/test_helper.rb +4 -2
  26. data/test/ua.yml +5 -0
  27. data/test/unit/accept_language_test.rb +1 -1
  28. data/test/unit/android_app_test.rb +3 -3
  29. data/test/unit/android_test.rb +17 -17
  30. data/test/unit/blackberry_test.rb +1 -1
  31. data/test/unit/bots_test.rb +15 -4
  32. data/test/unit/chrome_test.rb +1 -0
  33. data/test/unit/device_test.rb +25 -25
  34. data/test/unit/edge_test.rb +6 -0
  35. data/test/unit/electron_test.rb +1 -1
  36. data/test/unit/facebook_test.rb +3 -3
  37. data/test/unit/generic_test.rb +3 -3
  38. data/test/unit/instagram_test.rb +2 -2
  39. data/test/unit/internet_explorer_test.rb +18 -18
  40. data/test/unit/ios_app_test.rb +3 -3
  41. data/test/unit/ios_test.rb +12 -12
  42. data/test/unit/kindle_test.rb +15 -0
  43. data/test/unit/meta_test.rb +13 -13
  44. data/test/unit/platform_test.rb +33 -25
  45. data/test/unit/proxy_test.rb +2 -2
  46. data/test/unit/safari_test.rb +14 -9
  47. data/test/unit/snapchat_test.rb +3 -3
  48. data/test/unit/uc_browser_test.rb +1 -1
  49. data/test/unit/windows_test.rb +11 -11
  50. metadata +12 -77
data/test/test_helper.rb CHANGED
@@ -1,7 +1,9 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require "simplecov"
4
- SimpleCov.start
4
+ SimpleCov.start do
5
+ add_filter %r{/test/}
6
+ end
5
7
 
6
8
  ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../Gemfile", __dir__)
7
9
  require "bundler/setup"
@@ -14,7 +16,7 @@ require "yaml"
14
16
  module Minitest
15
17
  class Test
16
18
  setup do
17
- Browser::Bot.instance_variable_set("@detect_empty_ua", false)
19
+ Browser::Bot.instance_variable_set(:@detect_empty_ua, false)
18
20
  end
19
21
 
20
22
  def assert_deprecated(message, file, line, &block)
data/test/ua.yml CHANGED
@@ -83,6 +83,11 @@ KINDLE: "Mozilla/5.0 (Linux; U; en-US) AppleWebKit/528.5+ (KHTML, like Gecko, Sa
83
83
  KINDLE_FIRE: "Mozilla/5.0 (Linux; U; Android 2.3.4; en-us; Kindle Fire Build/GINGERBREAD) AppleWebKit/533.1 (KHTML, like Gecko) Version/4.0 Mobile Safari/533.1"
84
84
  KINDLE_FIRE_HD: "Mozilla/5.0 (Linux; U; en-us; KFTT Build/IML74K) AppleWebKit/535.19 (KHTML, like Gecko) Silk/3.4 Safari/535.19 Silk-Accelerated=true"
85
85
  KINDLE_FIRE_HD_MOBILE: "Mozilla/5.0 (Linux; U; Android 4.0.3; en-us; KFTT Build/IML74K) AppleWebKit/535.19 (KHTML, like Gecko) Silk/3.4 Mobile Safari/535.19 Silk-Accelerated=true"
86
+ KINDLE_SILK_TABLET: Mozilla/5.0 (Linux; Android 4.4.3; KFTHWI Build/KTU84M) AppleWebKit/537.36 (KHTML, like Gecko) Silk/44.1.54 like Chrome/44.0.2403.63 Safari/537.36
87
+ KINDLE_SILK_DESKTOP: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Silk/44.1.54 like Chrome/44.0.2403.63 Safari/537.36
88
+ KINDLE_SILK_MOBILE: Mozilla/5.0 (Linux; U; Android 4.4.3; KFTHWI Build/KTU84M) AppleWebKit/537.36 (KHTML, like Gecko) Silk/44.1.54 like Chrome/44.0.2403.63 Mobile Safari/537.36
89
+ KINDLE_SILK_TABLET_1ST_GEN: Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10_6_3; en-us; Silk/1.0.13.81_10003810) AppleWebKit/533.16 (KHTML, like Gecko) Version/5.0 Safari/533.16 Silk-Accelerated=true
90
+ KINDLE_SILK_MOBILE_1ST_GEN: Mozilla/5.0 (Linux; U; Android 2.3.4; en-us; Silk/1.0.13.81_10003810) AppleWebKit/533.1 (KHTML, like Gecko) Version/4.0 Mobile Safari/533.1 Silk-Accelerated=true
86
91
  LUMIA800: "Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; Trident/5.0; XBLWP7; ZuneWP7"
87
92
  MAC_OS: "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_3) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/13.0.5 Safari/605.1.15"
88
93
  MAC_OSX: "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_2) AppleWebKit/601.3.9 (KHTML, like Gecko) Version/9.0.2 Safari/601.3.9"
@@ -161,6 +161,6 @@ class AcceptLanguageTest < Minitest::Test
161
161
  test "sets default quality value for invalid strings" do
162
162
  result = Browser::AcceptLanguage.parse(";q=0.0.0.0")
163
163
 
164
- assert_equal 0.1, result[0].quality
164
+ assert_equal 0.1, result[0].quality # rubocop:disable Minitest/AssertInDelta
165
165
  end
166
166
  end
@@ -5,15 +5,15 @@ require "test_helper"
5
5
  class AndroidAppTest < Minitest::Test
6
6
  let(:browser) { Browser.new(Browser["ANDROID_WEBVIEW"]) }
7
7
 
8
- test "detect as android" do
8
+ test "detects as android" do
9
9
  assert browser.platform.android?
10
10
  end
11
11
 
12
- test "detect as webview" do
12
+ test "detects as webview" do
13
13
  assert browser.platform.android_webview?
14
14
  end
15
15
 
16
- test "non-webviews do not detect as webview" do
16
+ test "does not detect non-webviews as webview" do
17
17
  %w[
18
18
  ANDROID_CUPCAKE
19
19
  ANDROID_DONUT
@@ -3,102 +3,102 @@
3
3
  require "test_helper"
4
4
 
5
5
  class AndroidTest < Minitest::Test
6
- test "detect android cupcake (1.5)" do
6
+ test "detects android cupcake (1.5)" do
7
7
  browser = Browser.new(Browser["ANDROID_CUPCAKE"])
8
8
  assert browser.platform.android?
9
9
  assert browser.platform.android?(1.5)
10
10
  end
11
11
 
12
- test "detect android donut (1.6)" do
12
+ test "detects android donut (1.6)" do
13
13
  browser = Browser.new(Browser["ANDROID_DONUT"])
14
14
  assert browser.platform.android?
15
15
  assert browser.platform.android?(1.6)
16
16
  end
17
17
 
18
- test "detect android eclair (2.1)" do
18
+ test "detects android eclair (2.1)" do
19
19
  browser = Browser.new(Browser["ANDROID_ECLAIR_21"])
20
20
  assert browser.platform.android?
21
21
  assert browser.platform.android?(2.1)
22
22
  end
23
23
 
24
- test "detect android froyo (2.2)" do
24
+ test "detects android froyo (2.2)" do
25
25
  browser = Browser.new(Browser["ANDROID_FROYO"])
26
26
  assert browser.platform.android?
27
27
  assert browser.platform.android?(2.2)
28
28
  end
29
29
 
30
- test "detect android gingerbread (2.3)" do
30
+ test "detects android gingerbread (2.3)" do
31
31
  browser = Browser.new(Browser["ANDROID_GINGERBREAD"])
32
32
  assert browser.platform.android?
33
33
  assert browser.platform.android?("~> 2.3.0")
34
34
  end
35
35
 
36
- test "detect android honeycomb (3.0)" do
36
+ test "detects android honeycomb (3.0)" do
37
37
  browser = Browser.new(Browser["ANDROID_HONEYCOMB_30"])
38
38
  assert browser.platform.android?
39
39
  assert browser.platform.android?("~> 3.0")
40
40
  end
41
41
 
42
- test "detect android ice cream sandwich (4.0)" do
42
+ test "detects android ice cream sandwich (4.0)" do
43
43
  browser = Browser.new(Browser["ANDROID_ICECREAM"])
44
44
  assert browser.platform.android?
45
45
  assert browser.platform.android?("~> 4.0")
46
46
  end
47
47
 
48
- test "detect android jellybean (4.1)" do
48
+ test "detects android jellybean (4.1)" do
49
49
  browser = Browser.new(Browser["ANDROID_JELLYBEAN_41"])
50
50
  assert browser.platform.android?
51
51
  assert browser.platform.android?("~> 4.1")
52
52
  end
53
53
 
54
- test "detect android jellybean (4.2)" do
54
+ test "detects android jellybean (4.2)" do
55
55
  browser = Browser.new(Browser["ANDROID_JELLYBEAN_42"])
56
56
  assert browser.platform.android?
57
57
  assert browser.platform.android?(4.2)
58
58
  end
59
59
 
60
- test "detect android jellybean (4.3)" do
60
+ test "detects android jellybean (4.3)" do
61
61
  browser = Browser.new(Browser["ANDROID_JELLYBEAN_43"])
62
62
  assert browser.platform.android?
63
63
  assert browser.platform.android?(4.3)
64
64
  end
65
65
 
66
- test "detect android kitkat (4.4)" do
66
+ test "detects android kitkat (4.4)" do
67
67
  browser = Browser.new(Browser["ANDROID_KITKAT"])
68
68
  assert browser.platform.android?
69
69
  assert browser.platform.android?(4.4)
70
70
  end
71
71
 
72
- test "detect android lollipop (5.0)" do
72
+ test "detects android lollipop (5.0)" do
73
73
  browser = Browser.new(Browser["ANDROID_LOLLIPOP_50"])
74
74
  assert browser.platform.android?
75
75
  assert browser.platform.android?(5.0)
76
76
  end
77
77
 
78
- test "detect android lollipop (5.1)" do
78
+ test "detects android lollipop (5.1)" do
79
79
  browser = Browser.new(Browser["ANDROID_LOLLIPOP_51"])
80
80
  assert browser.platform.android?
81
81
  assert browser.platform.android?(5.1)
82
82
  end
83
83
 
84
- test "detect android oreo (8.0)" do
84
+ test "detects android oreo (8.0)" do
85
85
  browser = Browser.new(Browser["ANDROID_OREO"])
86
86
  assert browser.platform.android?
87
87
  assert browser.platform.android?(8.0)
88
88
  end
89
89
 
90
- test "detect android tv" do
90
+ test "detects android tv" do
91
91
  browser = Browser.new(Browser["ANDROID_TV"])
92
92
  assert browser.platform.android?
93
93
  assert browser.device.tv?
94
94
  end
95
95
 
96
- test "detect nexus player" do
96
+ test "detects nexus player" do
97
97
  browser = Browser.new(Browser["ANDROID_NEXUS_PLAYER"])
98
98
  assert browser.platform.android?
99
99
  end
100
100
 
101
- test "detect firefox for android without android version" do
101
+ test "detects firefox for android without android version" do
102
102
  browser = Browser.new(Browser["FIREFOX_ANDROID"])
103
103
 
104
104
  assert browser.platform.android?
@@ -72,7 +72,7 @@ class BlackberryTest < Minitest::Test
72
72
  assert_equal "7", browser.version
73
73
  end
74
74
 
75
- test "don't detect as two different versions" do
75
+ test "does not detect as two different versions" do
76
76
  browser = Browser.new(Browser["BLACKBERRY10"])
77
77
  assert browser.platform.blackberry?("~> 10.0")
78
78
  refute browser.platform.blackberry?("~> 7.0")
@@ -4,13 +4,13 @@ require "test_helper"
4
4
 
5
5
  class BotsTest < Minitest::Test
6
6
  Browser.bot_user_agents.each do |key, ua|
7
- test "detect #{key} as bot" do
7
+ test "detects #{key} as bot" do
8
8
  browser = Browser.new(ua)
9
9
  assert browser.bot?
10
10
  end
11
11
  end
12
12
 
13
- test "don't detect as bot" do
13
+ test "does not detect as bot" do
14
14
  browser = Browser.new(Browser["CHROME"])
15
15
  refute browser.bot?
16
16
  end
@@ -55,7 +55,7 @@ class BotsTest < Minitest::Test
55
55
  refute browser.safari?
56
56
  end
57
57
 
58
- test "custom android user agent (#144)" do
58
+ test "handles custom android user agent (#144)" do
59
59
  browser = Browser.new(Browser["CUSTOM_APP"])
60
60
 
61
61
  assert browser.platform.android?
@@ -86,7 +86,7 @@ class BotsTest < Minitest::Test
86
86
  end
87
87
 
88
88
  test "adds custom bot matcher" do
89
- Browser::Bot.matchers << ->(ua, _) { ua.match?(/some-script/) }
89
+ Browser::Bot.matchers << ->(ua, _) { ua.include?("some-script") }
90
90
  browser = Browser.new("some-script")
91
91
 
92
92
  assert browser.bot?
@@ -108,4 +108,15 @@ class BotsTest < Minitest::Test
108
108
  assert_equal Browser::Bot::KeywordMatcher, browser.bot.why?
109
109
  end
110
110
  end
111
+
112
+ test "extends lists" do
113
+ Browser::Bot.bots["another-bot"] = "Another bot"
114
+ Browser::Bot.bot_exceptions.push("exclude-this-bot")
115
+ Browser::Bot.search_engines["new-search-engine"] = "New search engine"
116
+
117
+ assert_equal "Another bot", Browser::Bot.bots["another-bot"]
118
+ assert_includes Browser::Bot.bot_exceptions, "exclude-this-bot"
119
+ assert_equal "New search engine",
120
+ Browser::Bot.search_engines["new-search-engine"]
121
+ end
111
122
  end
@@ -12,6 +12,7 @@ class ChromeTest < Minitest::Test
12
12
  assert browser.webkit?
13
13
  assert_equal "5.0.375.99", browser.full_version
14
14
  assert_equal "5", browser.version
15
+ assert browser.chromium_based?
15
16
  end
16
17
 
17
18
  test "detects mobile chrome" do
@@ -13,7 +13,7 @@ class DeviceTest < Minitest::Test
13
13
  end
14
14
  end
15
15
 
16
- test "extend matchers" do
16
+ test "extends matchers" do
17
17
  Browser::Device.matchers.unshift(CustomDevice)
18
18
  device = Browser::Device.new("Custom")
19
19
  assert_equal :custom, device.id
@@ -23,28 +23,28 @@ class DeviceTest < Minitest::Test
23
23
  assert_equal :unknown_device, device.id
24
24
  end
25
25
 
26
- test "detect generic device" do
26
+ test "detects generic device" do
27
27
  device = Browser::Device.new("")
28
28
 
29
29
  assert device.unknown?
30
30
  assert_equal :unknown_device, device.id
31
31
  end
32
32
 
33
- test "detect ipad" do
33
+ test "detects ipad" do
34
34
  device = Browser::Device.new(Browser["IOS9"])
35
35
  assert device.ipad?
36
36
  assert_equal :ipad, device.id
37
37
  assert_equal "iPad", device.name
38
38
  end
39
39
 
40
- test "detect old ipad" do
40
+ test "detects old ipad" do
41
41
  device = Browser::Device.new(Browser["IOS3"])
42
42
  assert device.ipad?
43
43
  assert_equal :ipad, device.id
44
44
  assert_equal "iPad", device.name
45
45
  end
46
46
 
47
- test "detect ipod" do
47
+ test "detects ipod" do
48
48
  device = Browser::Device.new(Browser["IPOD"])
49
49
  assert device.ipod_touch?
50
50
  assert device.ipod?
@@ -52,14 +52,14 @@ class DeviceTest < Minitest::Test
52
52
  assert_equal "iPod Touch", device.name
53
53
  end
54
54
 
55
- test "detect iphone" do
55
+ test "detects iphone" do
56
56
  device = Browser::Device.new(Browser["IOS8"])
57
57
  assert device.iphone?
58
58
  assert_equal :iphone, device.id
59
59
  assert_equal "iPhone", device.name
60
60
  end
61
61
 
62
- test "detect ps3" do
62
+ test "detects ps3" do
63
63
  device = Browser::Device.new(Browser["PLAYSTATION3"])
64
64
  assert device.ps3?
65
65
  assert device.playstation3?
@@ -68,7 +68,7 @@ class DeviceTest < Minitest::Test
68
68
  assert_equal "PlayStation 3", device.name
69
69
  end
70
70
 
71
- test "detect ps4" do
71
+ test "detects ps4" do
72
72
  device = Browser::Device.new(Browser["PLAYSTATION4"])
73
73
  assert device.ps4?
74
74
  assert device.playstation4?
@@ -99,14 +99,14 @@ class DeviceTest < Minitest::Test
99
99
  assert_equal "Xbox One", device.name
100
100
  end
101
101
 
102
- test "detect psp" do
102
+ test "detects psp" do
103
103
  device = Browser::Device.new(Browser["PSP"])
104
104
  assert device.psp?
105
105
  assert_equal :psp, device.id
106
106
  assert_equal "PlayStation Portable", device.name
107
107
  end
108
108
 
109
- test "detect psvita" do
109
+ test "detects psvita" do
110
110
  device = Browser::Device.new(Browser["PSP_VITA"])
111
111
  assert device.playstation_vita?
112
112
  assert device.vita?
@@ -114,7 +114,7 @@ class DeviceTest < Minitest::Test
114
114
  assert_equal "PlayStation Vita", device.name
115
115
  end
116
116
 
117
- test "detect kindle" do
117
+ test "detects kindle" do
118
118
  device = Browser::Device.new(Browser["KINDLE"])
119
119
  assert device.kindle?
120
120
  assert_equal :kindle, device.id
@@ -127,7 +127,7 @@ class DeviceTest < Minitest::Test
127
127
  KINDLE_FIRE_HD
128
128
  KINDLE_FIRE_HD_MOBILE
129
129
  ].each do |key|
130
- test "detect #{key} as kindle fire" do
130
+ test "detects #{key} as kindle fire" do
131
131
  device = Browser::Device.new(Browser[key])
132
132
 
133
133
  assert device.kindle?
@@ -137,7 +137,7 @@ class DeviceTest < Minitest::Test
137
137
  end
138
138
  end
139
139
 
140
- test "detect wii" do
140
+ test "detects wii" do
141
141
  device = Browser::Device.new(Browser["NINTENDO_WII"])
142
142
  assert device.nintendo_wii?
143
143
  assert device.console?
@@ -147,7 +147,7 @@ class DeviceTest < Minitest::Test
147
147
  assert_equal "Nintendo Wii", device.name
148
148
  end
149
149
 
150
- test "detect wiiu" do
150
+ test "detects wiiu" do
151
151
  device = Browser::Device.new(Browser["NINTENDO_WIIU"])
152
152
  assert device.nintendo_wiiu?
153
153
  assert device.wiiu?
@@ -157,7 +157,7 @@ class DeviceTest < Minitest::Test
157
157
  assert_equal "Nintendo WiiU", device.name
158
158
  end
159
159
 
160
- test "detect switch" do
160
+ test "detects switch" do
161
161
  device = Browser::Device.new(Browser["NINTENDO_SWITCH"])
162
162
  assert device.nintendo_switch?
163
163
  assert device.switch?
@@ -167,7 +167,7 @@ class DeviceTest < Minitest::Test
167
167
  assert_equal "Nintendo Switch", device.name
168
168
  end
169
169
 
170
- test "detect blackberry playbook" do
170
+ test "detects blackberry playbook" do
171
171
  device = Browser::Device.new(Browser["PLAYBOOK"])
172
172
  assert device.playbook?
173
173
  assert device.blackberry_playbook?
@@ -175,21 +175,21 @@ class DeviceTest < Minitest::Test
175
175
  assert_equal "BlackBerry Playbook", device.name
176
176
  end
177
177
 
178
- test "detect surface" do
178
+ test "detects surface" do
179
179
  device = Browser::Device.new(Browser["SURFACE"])
180
180
  assert device.surface?
181
181
  assert_equal :surface, device.id
182
182
  assert_equal "Microsoft Surface", device.name
183
183
  end
184
184
 
185
- test "detect tv" do
185
+ test "detects tv" do
186
186
  device = Browser::Device.new(Browser["SMART_TV"])
187
187
  assert device.tv?
188
188
  assert_equal :tv, device.id
189
189
  assert_equal "TV", device.name
190
190
  end
191
191
 
192
- test "detect unknown device" do
192
+ test "detects unknown device" do
193
193
  device = Browser::Device.new("")
194
194
 
195
195
  assert device.unknown?
@@ -214,7 +214,7 @@ class DeviceTest < Minitest::Test
214
214
  OPERA_MOBI
215
215
  KINDLE_FIRE_HD_MOBILE
216
216
  ].each do |key|
217
- test "detect #{key} as mobile" do
217
+ test "detects #{key} as mobile" do
218
218
  device = Browser::Device.new(Browser[key])
219
219
  assert device.mobile?
220
220
  refute device.tablet?
@@ -232,7 +232,7 @@ class DeviceTest < Minitest::Test
232
232
  FIREFOX_TABLET
233
233
  NEXUS7
234
234
  ].each do |key|
235
- test "detect #{key} as tablet" do
235
+ test "detects #{key} as tablet" do
236
236
  device = Browser::Device.new(Browser[key])
237
237
  assert device.tablet?
238
238
  refute device.mobile?
@@ -253,13 +253,13 @@ class DeviceTest < Minitest::Test
253
253
  "CUSTOM_APP" => "HTC Ruby",
254
254
  "NOOK" => "NOOK BNTV250A"
255
255
  }.each do |key, name|
256
- test "detect device name of #{key} as #{name}" do
256
+ test "detects device name of #{key} as #{name}" do
257
257
  device = Browser::Device.new(Browser[key])
258
258
  assert_equal name, device.name
259
259
  end
260
260
  end
261
261
 
262
- test "detect samsung devices" do
262
+ test "detects samsung devices" do
263
263
  device = Browser::Device.new(Browser["SAMSUNG_SM-G975F"])
264
264
 
265
265
  assert device.samsung?
@@ -267,7 +267,7 @@ class DeviceTest < Minitest::Test
267
267
  assert_equal "Samsung Galaxy S10+", device.name
268
268
  end
269
269
 
270
- test "detect generic samsung devices" do
270
+ test "detects generic samsung devices" do
271
271
  device = Browser::Device.new(Browser["SAMSUNG_SM-FAKE"])
272
272
 
273
273
  assert device.samsung?
@@ -280,7 +280,7 @@ class DeviceTest < Minitest::Test
280
280
  "SAMSUNG_SM-G960F" => "Samsung Galaxy S9",
281
281
  "SAMSUNG_SM-F700F" => "Samsung Galaxy Z Flip"
282
282
  }.each do |key, name|
283
- test "detect device name of #{key} as #{name}" do
283
+ test "detects device name of #{key} as #{name}" do
284
284
  device = Browser::Device.new(Browser[key])
285
285
  assert_equal name, device.name
286
286
  end
@@ -16,6 +16,7 @@ class EdgeTest < ActionController::TestCase
16
16
  refute browser.chrome?
17
17
  refute browser.safari?
18
18
  refute browser.device.mobile?
19
+ refute browser.chromium_based?
19
20
  end
20
21
 
21
22
  test "detects Microsoft Edge in compatibility view" do
@@ -33,6 +34,7 @@ class EdgeTest < ActionController::TestCase
33
34
  refute browser.chrome?
34
35
  refute browser.safari?
35
36
  refute browser.device.mobile?
37
+ refute browser.chromium_based?
36
38
  end
37
39
 
38
40
  test "detects Microsoft Edge Mobile" do
@@ -48,6 +50,7 @@ class EdgeTest < ActionController::TestCase
48
50
  refute browser.webkit?
49
51
  refute browser.chrome?
50
52
  refute browser.safari?
53
+ refute browser.chromium_based?
51
54
  end
52
55
 
53
56
  test "detects Microsoft Edge based on Chrome" do
@@ -58,6 +61,7 @@ class EdgeTest < ActionController::TestCase
58
61
  assert_equal "79.0.309.18", browser.full_version
59
62
  assert_equal "79", browser.version
60
63
  assert browser.platform.mac?
64
+ assert browser.chromium_based?
61
65
  refute browser.platform.windows?
62
66
  assert browser.edge?
63
67
  assert browser.webkit?
@@ -79,6 +83,7 @@ class EdgeTest < ActionController::TestCase
79
83
  refute browser.webkit?
80
84
  refute browser.chrome?
81
85
  refute browser.safari?
86
+ refute browser.chromium_based?
82
87
  end
83
88
 
84
89
  test "detects Microsoft Edge Mobile on Android" do
@@ -95,6 +100,7 @@ class EdgeTest < ActionController::TestCase
95
100
  refute browser.webkit?
96
101
  refute browser.chrome?
97
102
  refute browser.safari?
103
+ refute browser.chromium_based?
98
104
  end
99
105
 
100
106
  test "detects version by range" do
@@ -3,7 +3,7 @@
3
3
  require "test_helper"
4
4
 
5
5
  class ElectronTest < Minitest::Test
6
- test "detect electron" do
6
+ test "detects electron" do
7
7
  browser = Browser.new(Browser["ELECTRON"])
8
8
 
9
9
  assert_equal "Electron", browser.name
@@ -8,7 +8,7 @@ class FacebookTest < Minitest::Test
8
8
 
9
9
  assert_equal "Facebook", browser.name
10
10
  assert browser.facebook?
11
- assert :facebook, browser.id
11
+ assert_equal :facebook, browser.id
12
12
  assert_equal "135.0.0.45.90", browser.full_version
13
13
  assert_equal "135", browser.version
14
14
  end
@@ -18,7 +18,7 @@ class FacebookTest < Minitest::Test
18
18
 
19
19
  assert_equal "Facebook", browser.name
20
20
  assert browser.facebook?
21
- assert :facebook, browser.id
21
+ assert_equal :facebook, browser.id
22
22
  assert_equal "AppleWebKit/605.1.15", browser.full_version
23
23
  assert_equal "AppleWebKit/605", browser.version
24
24
  end
@@ -28,7 +28,7 @@ class FacebookTest < Minitest::Test
28
28
 
29
29
  assert_equal "Facebook", browser.name
30
30
  assert browser.facebook?
31
- assert :facebook, browser.id
31
+ assert_equal :facebook, browser.id
32
32
  assert_equal "214.0.0.43.83", browser.full_version
33
33
  assert_equal "214", browser.version
34
34
  end
@@ -3,20 +3,20 @@
3
3
  require "test_helper"
4
4
 
5
5
  class GenericTest < Minitest::Test
6
- test "return default msie version" do
6
+ test "returns default msie version" do
7
7
  browser = Browser.new("")
8
8
 
9
9
  assert_equal "0.0", browser.msie_full_version
10
10
  assert_equal "0", browser.msie_version
11
11
  end
12
12
 
13
- test "return default compatibility view" do
13
+ test "returns default compatibility view" do
14
14
  browser = Browser.new("")
15
15
 
16
16
  refute browser.compatibility_view?
17
17
  end
18
18
 
19
- test "return default safari web app mode" do
19
+ test "returns default safari web app mode" do
20
20
  browser = Browser.new("")
21
21
 
22
22
  refute browser.safari_webapp_mode?
@@ -8,7 +8,7 @@ class InstagramTest < Minitest::Test
8
8
 
9
9
  assert_equal "Instagram", browser.name
10
10
  assert browser.instagram?
11
- assert :instagram, browser.id
11
+ assert_equal :instagram, browser.id
12
12
  assert_equal "41.0.0.14.90", browser.full_version
13
13
  assert_equal "41", browser.version
14
14
  end
@@ -18,7 +18,7 @@ class InstagramTest < Minitest::Test
18
18
 
19
19
  assert_equal "Instagram", browser.name
20
20
  assert browser.instagram?
21
- assert :instagram, browser.id
21
+ assert_equal :instagram, browser.id
22
22
  assert_equal "182257141", browser.full_version
23
23
  assert_equal "182257141", browser.version
24
24
  end
@@ -261,43 +261,43 @@ class IeTest < Minitest::Test
261
261
  browser = Browser.new(Browser["IE6"])
262
262
  meta = browser.meta
263
263
 
264
- assert meta.include?("ie")
265
- assert meta.include?("ie6")
266
- assert meta.include?("oldie")
267
- assert meta.include?("lt-ie8")
268
- assert meta.include?("lt-ie9")
269
- assert meta.include?("windows")
264
+ assert_includes meta, "ie"
265
+ assert_includes meta, "ie6"
266
+ assert_includes meta, "oldie"
267
+ assert_includes meta, "lt-ie8"
268
+ assert_includes meta, "lt-ie9"
269
+ assert_includes meta, "windows"
270
270
  end
271
271
 
272
272
  test "returns string representation for ie7" do
273
273
  browser = Browser.new(Browser["IE7"])
274
274
  meta = browser.meta
275
275
 
276
- assert meta.include?("ie")
277
- assert meta.include?("ie7")
278
- assert meta.include?("oldie")
279
- assert meta.include?("lt-ie8")
280
- assert meta.include?("lt-ie9")
281
- assert meta.include?("windows")
276
+ assert_includes meta, "ie"
277
+ assert_includes meta, "ie7"
278
+ assert_includes meta, "oldie"
279
+ assert_includes meta, "lt-ie8"
280
+ assert_includes meta, "lt-ie9"
281
+ assert_includes meta, "windows"
282
282
  end
283
283
 
284
284
  test "returns string representation for ie8" do
285
285
  browser = Browser.new(Browser["IE8"])
286
286
  meta = browser.meta
287
287
 
288
- assert meta.include?("ie")
289
- assert meta.include?("ie8")
290
- assert meta.include?("lt-ie9")
291
- assert meta.include?("windows")
288
+ assert_includes meta, "ie"
289
+ assert_includes meta, "ie8"
290
+ assert_includes meta, "lt-ie9"
291
+ assert_includes meta, "windows"
292
292
  end
293
293
 
294
- test "don't detect as two different versions" do
294
+ test "does not detect as two different versions" do
295
295
  browser = Browser.new(Browser["IE8"])
296
296
  assert browser.ie?(8)
297
297
  refute browser.ie?(7)
298
298
  end
299
299
 
300
- test "more complex versioning check" do
300
+ test "handles more complex versioning check" do
301
301
  browser = Browser.new(Browser["IE8"])
302
302
  assert browser.ie?(["> 7", "< 9"])
303
303
  end
@@ -5,15 +5,15 @@ require "test_helper"
5
5
  class IosAppTest < Minitest::Test
6
6
  let(:browser) { Browser.new(Browser["IOS_WEBVIEW"]) }
7
7
 
8
- test "detect as ios" do
8
+ test "detects as ios" do
9
9
  assert browser.platform.ios?
10
10
  end
11
11
 
12
- test "don't detect as safari" do
12
+ test "does not detect as safari" do
13
13
  refute browser.safari?
14
14
  end
15
15
 
16
- test "detect as webview" do
16
+ test "detects as webview" do
17
17
  assert browser.platform.ios_webview?
18
18
  end
19
19
  end