browser 4.0.0 → 4.1.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 75c57477baeccabb50b2c056dcd65d33beb39b2bfb066338062a0d58f372648d
4
- data.tar.gz: a2a7ae9958798ab7e04545101087f2c06f2cc241e00eef38c04eb478e477f015
3
+ metadata.gz: e77d6a7b8f14ab25f374f72faeb65e922b04c505f1f5dda6f238e3bca45e47b2
4
+ data.tar.gz: fe6b730f514a0cb75050ea5f799c281c72e068b240712ce4c8981bc18031838a
5
5
  SHA512:
6
- metadata.gz: f01337cf351ba371d85a37ae957aa04f71854103c2fad413583a6258d66a8218595528464e1aa9f6e273824340c9ca29fe7048ad676a73dbc69dcb8220ecf2f8
7
- data.tar.gz: d3729b88eb7e6a0c92a2d9f14d9b2c073fe782f6045c6ffb74f74766bf353b92f3660154e434c6020a6870810843c1948e658a1c87f1f15454b1fbec7bc135b4
6
+ metadata.gz: 5e760498efafda0f1900dd29e19d5af21912cfe904dfe3167e001138ac2ba1608e916be5f00066f86b2f471724e2234418891bf66b638b75ee67b074f1bdc251
7
+ data.tar.gz: a190f555bfb9857cd05277e7b3d73670a5642411b91dafc5a811d3fbef5d0987f4612fe205ffd3bc8c229d06965910dfa42fec4e787f4107521d4ac97d63c77e
@@ -0,0 +1 @@
1
+ *.yml
@@ -33,3 +33,6 @@ Metrics/AbcSize:
33
33
 
34
34
  Metrics/CyclomaticComplexity:
35
35
  Enabled: false
36
+
37
+ Metrics/PerceivedComplexity:
38
+ Enabled: false
@@ -2,6 +2,19 @@
2
2
 
3
3
  ## Unreleased
4
4
 
5
+ Nothing
6
+
7
+ ## 4.1.0
8
+
9
+ - Add Samsung browser.
10
+ - Add Google Image Proxy to the bot list.
11
+ - Add The Knowledge AI bot to the bot list.
12
+ - Add Go HttpClient to the bot list.
13
+ - Fix Microsoft Edge detection on Android and iOS.
14
+ - Fix MicroMessenger detection on Android
15
+
16
+ ## 4.0.0
17
+
5
18
  - Add Chrome Lighthouse to bot list.
6
19
  - Add SeobilityBot to the bot list.
7
20
  - Detect Mac-based platforms differently, depending on the version; "Mac OS X"
data/README.md CHANGED
@@ -318,21 +318,6 @@ Rails.configuration.middleware.use Browser::Middleware do
318
318
  end
319
319
  ```
320
320
 
321
- ### Migrating to v2
322
-
323
- #### Troubleshooting
324
-
325
- ##### `TypeError: no implicit conversion of Hash into String`
326
-
327
- The class constructor now has a different signature. Change the instantiation from `Browser.new(options)` to `Browser.new(ua, options)`, where:
328
-
329
- - `ua`: must be a string representing the user agent.
330
- - `options`: must be a hash (for now it only accepts the `accept_language` option).
331
-
332
- ##### `NoMethodError: undefined method 'user_agent'`
333
-
334
- `.ua` can now be used to retrieve the full User Agent string.
335
-
336
321
  ## Development
337
322
 
338
323
  ### Versioning
data/bots.yml CHANGED
@@ -88,14 +88,16 @@ gigabot: "Gigabot spider"
88
88
  gimme60bot: "Gimme60 (gimme60.com)"
89
89
  gimmeusabot: "Gimme60 (gimme60.com)"
90
90
  go http package: "Go http library"
91
+ go-http-client: "Go http client"
91
92
  google page speed insights: "Google Page Speed Insights"
92
- google Web Preview: "Google Instant Previews crawler"
93
- google-site-verification: Google-Site-Verification
94
- google-structured-data-testing-tool: "Google-StructuredDataTestingTool"
95
- google-structureddatatestingtool: "Google-StructuredDataTestingTool"
93
+ google web preview: "Google Instant Previews crawler"
94
+ google-site-verification: Google Site Verification
95
+ google-structured-data-testing-tool: "Google Structured Data Testing Tool"
96
+ google-structureddatatestingtool: "Google Structured Data Testing Tool"
96
97
  google-xrawler: "Google Shopping"
97
98
  googlebot: "Google Bot"
98
- googlestackdrivermonitoring-uptimechecks: "GoogleStackdriverMonitoring-UptimeChecks"
99
+ googleimageproxy: "Google Image Proxy"
100
+ googlestackdrivermonitoring-uptimechecks: "Google Stackdriver Monitoring - Uptime Checks"
99
101
  grapeshotcrawler: "GrapeshotCrawler"
100
102
  gravitybot: "Gravity Bot"
101
103
  hatena::bookmark: "Hatena::Bookmark"
@@ -215,10 +217,10 @@ siege: "Joe Dog Siege"
215
217
  sistrix: "SISTRIX"
216
218
  sitecheck: "SiteCheck sitecrawl"
217
219
  siteuptime: "Site monitoring services"
218
- slack: "Slackbot-LinkExpanding"
219
- slackbot: "Slackbot 1.0(+https://api.slack.com/robots)"
220
220
  slack-imgproxy: "Slack-ImgProxy 0.19 (+https://api.slack.com/robots)"
221
221
  slack-linkexpanding: "Slackbot-LinkExpanding 1.0 (+https://api.slack.com/robots)"
222
+ slack: "Slackbot-LinkExpanding"
223
+ slackbot: "Slackbot 1.0(+https://api.slack.com/robots)"
222
224
  slurp: "Yahoo spider"
223
225
  smtbot: "SimilarTech"
224
226
  snapchat: "Snapchat"
@@ -234,6 +236,7 @@ swiftbot: "Swiftype Bot"
234
236
  tangibleebot: "TangibleeBot"
235
237
  teeraid: "TeeRaidBot"
236
238
  test certificate info: "C http library?"
239
+ the knowledge ai: "Knowledge AI Bot"
237
240
  tineye: "TinEye Bot"
238
241
  traackr: "Traackr Bot"
239
242
  trendictionbot: "Trendiction Search"
@@ -13,6 +13,8 @@ Gem::Specification.new do |s|
13
13
  s.description = s.summary
14
14
  s.license = "MIT"
15
15
 
16
+ s.metadata["changelog_uri"] = "https://github.com/fnando/browser/blob/master/CHANGELOG.md"
17
+
16
18
  s.files = `git ls-files`.split("\n")
17
19
  s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
18
20
  s.executables = `git ls-files -- exe/*`
@@ -192,6 +192,11 @@ module Browser
192
192
  ua =~ /DuckDuckGo/ && detect_version?(full_version, expected_version)
193
193
  end
194
194
 
195
+ # Detect if browser is Samsung.
196
+ def samsung_browser?(expected_version = nil)
197
+ ua =~ /SamsungBrowser/ && detect_version?(full_version, expected_version)
198
+ end
199
+
195
200
  def webkit_full_version
196
201
  ua[%r{AppleWebKit/([\d.]+)}, 1] || "0.0"
197
202
  end
@@ -31,6 +31,7 @@ require_relative "yandex"
31
31
  require_relative "sputnik"
32
32
  require_relative "snapchat"
33
33
  require_relative "duck_duck_go"
34
+ require_relative "samsung_browser"
34
35
 
35
36
  require_relative "bot"
36
37
  require_relative "bot/empty_user_agent_matcher"
@@ -66,15 +67,16 @@ module Browser
66
67
  Instagram, # must be placed before Chrome and Safari
67
68
  Snapchat, # must be placed before Chrome and Safari
68
69
  Weibo, # must be placed before Chrome and Safari
70
+ MicroMessenger, # must be placed before QQ
69
71
  QQ, # must be placed before Chrome and Safari
70
72
  Alipay, # must be placed before Chrome and Safari
71
73
  Electron, # must be placed before Chrome and Safari
72
74
  Yandex, # must be placed before Chrome and Safari
73
75
  Sputnik, # must be placed before Chrome and Safari
74
76
  DuckDuckGo, # must be placed before Chrome and Safari
77
+ SamsungBrowser, # must be placed before Chrome and Safari
75
78
  Chrome,
76
79
  Safari,
77
- MicroMessenger,
78
80
  Generic
79
81
  ]
80
82
  end
@@ -26,7 +26,8 @@ module Browser
26
26
  !edge? &&
27
27
  !duck_duck_go? &&
28
28
  !yandex? &&
29
- !sputnik?
29
+ !sputnik? &&
30
+ !samsung_browser?
30
31
  end
31
32
  end
32
33
  end
@@ -11,11 +11,11 @@ module Browser
11
11
  end
12
12
 
13
13
  def full_version
14
- ua[%r{(?:Edge|Edg)/([\d.]+)}, 1] || super
14
+ ua[%r{(?:Edge|Edg|EdgiOS|EdgA)/([\d.]+)}, 1] || super
15
15
  end
16
16
 
17
17
  def match?
18
- ua =~ %r{((?:Edge|Edg)/[\d.]+|Trident/8)}
18
+ ua =~ %r{((?:Edge|Edg|EdgiOS|EdgA)/[\d.]+|Trident/8)}
19
19
  end
20
20
 
21
21
  def chrome_based?
@@ -0,0 +1,21 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Browser
4
+ class SamsungBrowser < Chrome
5
+ def id
6
+ :samsung_browser
7
+ end
8
+
9
+ def name
10
+ "Samsung Browser"
11
+ end
12
+
13
+ def full_version
14
+ ua[%r{SamsungBrowser/([\d.]+)}, 1] || super
15
+ end
16
+
17
+ def match?
18
+ ua =~ /SamsungBrowser/
19
+ end
20
+ end
21
+ end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Browser
4
- VERSION = "4.0.0"
4
+ VERSION = "4.1.0"
5
5
  end
@@ -81,13 +81,16 @@ KINDLE_FIRE_HD_MOBILE: "Mozilla/5.0 (Linux; U; Android 4.0.3; en-us; KFTT Build/
81
81
  LUMIA800: "Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; Trident/5.0; XBLWP7; ZuneWP7"
82
82
  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"
83
83
  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"
84
- MICRO_MESSENGER: "Mozilla/5.0 (iPhone; CPU iPhone OS 9_3_1 like Mac OS X) AppleWebKit/601.1.46 (KHTML, like Gecko) Mobile/13E238 MicroMessenger/6.3.15 NetType/3G+ Language/zh_CN"
84
+ MICRO_MESSENGER_IOS: "Mozilla/5.0 (iPhone; CPU iPhone OS 13_3_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148 MicroMessenger/7.0.10(0x17000a21) NetType/4G Language/zh_CN"
85
+ MICRO_MESSENGER_ANDROID: "Mozilla/5.0 (Linux; Android 7.1.2; Redmi 4X Build/N2G47H; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/66.0.3359.126 MQQBrowser/6.2 TBS/045131 Mobile Safari/537.36 MMWEBID/9286 MicroMessenger/7.0.13.1640(0x27000D37) Process/tools NetType/WIFI Language/zh_CN ABI/arm64 WeChat/arm64"
85
86
  MIDP: MIDP-2.0
86
87
  MOBILE_CHROME: "Mozilla/5.0 (iPhone; U; CPU iPhone OS 5_1_1 like Mac OS X; en) AppleWebKit/534.46.0 (KHTML, like Gecko) CriOS/19.0.1084.60 Mobile/9B206 Safari/7534.48.3"
87
88
  MS_EDGE: "Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/39.0.2171.71 Safari/537.36 Edge/12.0"
88
89
  MS_EDGE_CHROME: "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/79.0.3945.29 Safari/537.36 Edg/79.0.309.18"
89
90
  MS_EDGE_COMPAT: "Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 6.2; WOW64; Trident/8.0; .NET4.0C; .NET4.0E; Tablet PC 2.0; Microsoft Outlook 15.0.4433; ms-office; MSOffice 15)"
90
91
  MS_EDGE_MOBILE: "Mozilla/5.0 (Windows Phone 10.0; Android 4.2.1; DEVICE INFO) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/39.0.2171.71 Mobile Safari/537.36 Edge/12.0"
92
+ MS_EDGE_IOS: "Mozilla/5.0 (iPhone; CPU iPhone OS 12_3_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/12.1.1 EdgiOS/44.5.0.10 Mobile/15E148 Safari/604.1"
93
+ MS_EDGE_ANDROID: "Mozilla/5.0 (Linux; Android 7.1.2; Redmi 4X) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/73.0.3683.0 Mobile Safari/537.36 EdgA/44.11.2.4122"
91
94
  NEXUS7: "Mozilla/5.0 (Linux; Android 4.3; Nexus 7 Build/JWR66Y) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/29.0.1547.72 Safari/537.36"
92
95
  NEXUS_TABLET: "Mozilla/5.0 (Linux; Android 4.1.1; Nexus 7 Build/JRO03D) AppleWebKit/535.19 (KHTML, like Gecko) Chrome/18.0.1025.166 Safari/535.19"
93
96
  NINTENDO_SWITCH: "Mozilla/5.0 (Nintendo Switch; WifiWebAuthApplet) AppleWebKit/601.6 (KHTML, like Gecko) NF/4.0.0.7.9 NintendoBrowser/5.1.0.15785"
@@ -123,6 +126,7 @@ SAFARI: "Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10_6_4; en-us) AppleWebKit/53
123
126
  SAFARI_IPAD_WEBAPP_MODE: "Mozilla/5.0 (iPad; U; CPU OS 3_2_1 like Mac OS X; en-us) AppleWebKit/531.21.10 (KHTML, like Gecko) Mobile/7B405"
124
127
  SAFARI_IPHONE_WEBAPP_MODE: "Mozilla/5.0 (iPhone; U; CPU iPhone OS 3_2 like Mac OS X; en-us) AppleWebKit/531.21.20 (KHTML, like Gecko) Mobile/7B298g"
125
128
  SAMSUNG: "Mozilla/5.0 (Linux; U; Android 4.0.4; en-us; SAMSUNG-SGH-I497 Build/IMM76D) AppleWebKit/534.30 (KHTML, like Gecko) Version/4.0 Safari/534.30"
129
+ SAMSUNG_BROWSER: "Mozilla/5.0 (Linux; Android 10; SAMSUNG SM-N960U) AppleWebKit/537.36 (KHTML, like Gecko) SamsungBrowser/11.1 Chrome/75.0.3770.143 Mobile Safari/537.36"
126
130
  SAMSUNG_CHROME: "Mozilla/5.0 (Linux; Android 4.4.2; en-gb; SAMSUNG GT-I9195/I9195XXUCNEA Build/KOT49H) AppleWebKit/537.36 (KHTML, like Gecko) Version/1.5 Chrome/28.0.1500.94 Mobile Safari/537.36"
127
131
  SMART_TV: "Mozilla/5.0 (SmartHub; SMART-TV; U; Linux/SmartTV) AppleWebKit/531.2+ (KHTML, like Gecko) WebBrowser/1.0 SmartTV Safari/531.2+"
128
132
  SNAPCHAT: Mozilla/5.0 (iPhone; CPU iPhone OS 13_2_2 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Snapchat/10.69.5.72 (iPhone10,3; iOS 13.2.2; gzip)
@@ -4,9 +4,9 @@ ADS_TXT_CRAWLER: "AdsTxtCrawler/1.0"
4
4
  ANDERSPINK: "Mozilla/5.0 (compatible; AndersPinkBot/1.0; +http://anderspink.com/bot.html)"
5
5
  APIS_GOOGLE: "APIs-Google; (+https://developers.google.com/webmasters/APIs-Google.html)"
6
6
  APPLE_BOT: "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_10_1) AppleWebKit/600.2.5 (KHTML, like Gecko) Version/8.0.2 Safari/600.2.5 (Applebot/0.1)"
7
+ ARCHIVEBOT: "ArchiveTeam ArchiveBot/20190617.01 (wpull 2.0.3) and not Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/42.0.2311.90 Safari/537.36"
7
8
  ASK: "Mozilla/2.0 (compatible; Ask Jeeves/Teoma; +http://sp.ask.com/docs/about/tech_crawling.html)"
8
9
  AWS_ELB: ELB-HealthChecker/1.0
9
- ARCHIVEBOT: "ArchiveTeam ArchiveBot/20190617.01 (wpull 2.0.3) and not Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/42.0.2311.90 Safari/537.36"
10
10
  BAIDU: "Baiduspider+(+http://www.baidu.com/search/spider.htm)"
11
11
  BARKROWLER: "Barkrowler/0.7 (+http://www.exensa.com/crawl)"
12
12
  BINGBOT: "Mozilla/5.0 (compatible; bingbot/2.0; +http://www.bing.com/bingbot.htm)"
@@ -31,7 +31,9 @@ FYREBOT: "Fyrebot/1.0"
31
31
  GARLIK: "GarlikCrawler/1.2 (http://garlik.com/, crawler@garlik.com)"
32
32
  GERMCRAWLER: "GermCrawler"
33
33
  GO_1.1_PACKAGE_HTTP: "Go 1.1 package http"
34
+ GO_HTTP_CLIENT: "Go-http-client"
34
35
  GOOGLE_BOT: "Mozilla/5.0 (compatible; Googlebot/2.1; +http://www.google.com/bot.html)"
36
+ GOOGLE_IMAGE_PROXY: "Mozilla/5.0 (Windows NT 5.1; rv:11.0) Gecko Firefox/11.0 (via ggpht.com GoogleImageProxy)"
35
37
  GOOGLE_PAGE_SPEED_INSIGHTS: "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.4 (KHTML, like Gecko; Google Page Speed Insights) Chrome/22.0.1229 Safari/537.4"
36
38
  GOOGLE_SHOPPING: "google-xrawler"
37
39
  GOOGLE_SITE_VERIFICATION: Mozilla/5.0 (compatible; Google-Site-Verification/1.0)
@@ -44,6 +46,7 @@ IMPLISENSEBOT: "ImplisenseBot 1.0"
44
46
  JAUNT: "Jaunt/1.5"
45
47
  JOBSEEKER: "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/538.1 (KHTML, like Gecko) JobBot/5.0 (compatible; +http://www.jobseeker.com.au/bot.html) Safari/538.1"
46
48
  JOOBLE: "Mozilla/5.0 (compatible; Jooblebot/2.0; Windows NT 6.1; WOW64; +http://jooble.org/jooble-bot) Mobile"
49
+ KNOWLEDGE_AI: "The Knowledge AI"
47
50
  LINKDEXBOT: "Mozilla/5.0 (compatible; linkdexbot/2.0; +http://www.linkdex.com/bots/)"
48
51
  LINKEDIN: "LinkedInBot/1.0 (compatible; Mozilla/5.0; Jakarta Commons-HttpClient/3.1 +http://www.linkedin.com)"
49
52
  LOAD_TIME_BOT: "Mozilla/5.0 (compatible; LoadTimeBot/0.9; +http://www.loadtime.net/bot.html)"
@@ -65,8 +65,40 @@ class EdgeTest < ActionController::TestCase
65
65
  refute browser.safari?
66
66
  end
67
67
 
68
+ test "detects Microsoft Edge Mobile on iOS" do
69
+ browser = Browser.new(Browser["MS_EDGE_IOS"])
70
+
71
+ assert_equal :edge, browser.id
72
+ assert_equal "Microsoft Edge", browser.name
73
+ assert_equal "44.5.0.10", browser.full_version
74
+ assert_equal "44", browser.version
75
+ refute browser.platform.windows10?
76
+ refute browser.platform.windows_phone?
77
+ assert browser.platform.ios?
78
+ assert browser.edge?
79
+ refute browser.webkit?
80
+ refute browser.chrome?
81
+ refute browser.safari?
82
+ end
83
+
84
+ test "detects Microsoft Edge Mobile on Android" do
85
+ browser = Browser.new(Browser["MS_EDGE_ANDROID"])
86
+
87
+ assert_equal :edge, browser.id
88
+ assert_equal "Microsoft Edge", browser.name
89
+ assert_equal "44.11.2.4122", browser.full_version
90
+ assert_equal "44", browser.version
91
+ refute browser.platform.windows10?
92
+ refute browser.platform.windows_phone?
93
+ assert browser.platform.android?
94
+ assert browser.edge?
95
+ refute browser.webkit?
96
+ refute browser.chrome?
97
+ refute browser.safari?
98
+ end
99
+
68
100
  test "detects version by range" do
69
- browser = Browser.new(Browser["MS_EDGE"])
70
- assert browser.edge?(%w[>=12 <13])
101
+ browser = Browser.new(Browser["MS_EDGE_IOS"])
102
+ assert browser.edge?(%w[>=43 <45])
71
103
  end
72
104
  end
@@ -3,18 +3,33 @@
3
3
  require "test_helper"
4
4
 
5
5
  class MicroMessengerTest < Minitest::Test
6
- test "detects micro messenger 6.3.15" do
7
- browser = Browser.new(Browser["MICRO_MESSENGER"])
6
+ test "detects micro messenger 7.0.10 on iOS" do
7
+ browser = Browser.new(Browser["MICRO_MESSENGER_IOS"])
8
8
 
9
9
  assert browser.micro_messenger?
10
10
  assert browser.wechat?
11
- assert_equal "6.3.15", browser.full_version
11
+ assert_equal "7.0.10", browser.full_version
12
12
  assert_equal "MicroMessenger", browser.name
13
13
  assert_equal :micro_messenger, browser.id
14
14
  end
15
15
 
16
- test "detects version by range" do
17
- browser = Browser.new(Browser["MICRO_MESSENGER"])
18
- assert browser.wechat?(%w[>=6 <7])
16
+ test "detects version by range on iOS" do
17
+ browser = Browser.new(Browser["MICRO_MESSENGER_IOS"])
18
+ assert browser.wechat?(%w[>=7 <8])
19
+ end
20
+
21
+ test "detects micro messenger 7.0.13.1640 on Android" do
22
+ browser = Browser.new(Browser["MICRO_MESSENGER_ANDROID"])
23
+
24
+ assert browser.micro_messenger?
25
+ assert browser.wechat?
26
+ assert_equal "7.0.13.1640", browser.full_version
27
+ assert_equal "MicroMessenger", browser.name
28
+ assert_equal :micro_messenger, browser.id
29
+ end
30
+
31
+ test "detects version by range on Android" do
32
+ browser = Browser.new(Browser["MICRO_MESSENGER_ANDROID"])
33
+ assert browser.wechat?(%w[>=7 <8])
19
34
  end
20
35
  end
@@ -0,0 +1,22 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "test_helper"
4
+
5
+ class SamsungBrowserTest < Minitest::Test
6
+ test "detects samsung browser" do
7
+ browser = Browser.new(Browser["SAMSUNG_BROWSER"])
8
+
9
+ assert browser.webkit?
10
+ assert browser.samsung_browser?
11
+ assert_equal "11", browser.version
12
+ assert_equal :samsung_browser, browser.id
13
+ assert_equal "11.1", browser.full_version
14
+ assert_equal "Samsung Browser", browser.name
15
+ refute browser.chrome?
16
+ end
17
+
18
+ test "detects version by range" do
19
+ browser = Browser.new(Browser["SAMSUNG_BROWSER"])
20
+ assert browser.samsung_browser?(%w[>=11 <12])
21
+ end
22
+ end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: browser
3
3
  version: !ruby/object:Gem::Version
4
- version: 4.0.0
4
+ version: 4.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Nando Vieira
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-02-25 00:00:00.000000000 Z
11
+ date: 2020-05-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -173,6 +173,7 @@ extra_rdoc_files: []
173
173
  files:
174
174
  - ".github/ISSUE_TEMPLATE.md"
175
175
  - ".gitignore"
176
+ - ".prettierignore"
176
177
  - ".rubocop.yml"
177
178
  - ".travis.yml"
178
179
  - CHANGELOG.md
@@ -268,6 +269,7 @@ files:
268
269
  - lib/browser/qq.rb
269
270
  - lib/browser/rails.rb
270
271
  - lib/browser/safari.rb
272
+ - lib/browser/samsung_browser.rb
271
273
  - lib/browser/snapchat.rb
272
274
  - lib/browser/sputnik.rb
273
275
  - lib/browser/testing.rb
@@ -315,6 +317,7 @@ files:
315
317
  - test/unit/proxy_test.rb
316
318
  - test/unit/qq_test.rb
317
319
  - test/unit/safari_test.rb
320
+ - test/unit/samsung_browser_test.rb
318
321
  - test/unit/snapchat_test.rb
319
322
  - test/unit/sputnik_test.rb
320
323
  - test/unit/uc_browser_test.rb
@@ -325,7 +328,8 @@ files:
325
328
  homepage: http://github.com/fnando/browser
326
329
  licenses:
327
330
  - MIT
328
- metadata: {}
331
+ metadata:
332
+ changelog_uri: https://github.com/fnando/browser/blob/master/CHANGELOG.md
329
333
  post_install_message:
330
334
  rdoc_options: []
331
335
  require_paths:
@@ -385,6 +389,7 @@ test_files:
385
389
  - test/unit/proxy_test.rb
386
390
  - test/unit/qq_test.rb
387
391
  - test/unit/safari_test.rb
392
+ - test/unit/samsung_browser_test.rb
388
393
  - test/unit/snapchat_test.rb
389
394
  - test/unit/sputnik_test.rb
390
395
  - test/unit/uc_browser_test.rb