browser 1.0.0 → 1.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/browser/methods/ie.rb +2 -2
- data/lib/browser/version.rb +1 -1
- data/test/browser_spec.rb +39 -0
- data/test/ua.yml +2 -0
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9031876dc90f573a2ffda6d231a2c7de9ac6a439
|
4
|
+
data.tar.gz: 5818318b74f5ee5be969f7e485f35ed6d52b304e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 335cffa588eec7e11c993d7a661d44708793509e7689b3546493db16245b9a41024d99f28ba9952f97d584963b60ef5594a0d58de300dd918afa4e15cf6e50e9
|
7
|
+
data.tar.gz: 1bb8865ddbe1fbf827e820fdbc03a6028c324ab6589dde88ef65be920d73e605616c670b3865d04376a17c18df66c83457abe168bfdb9f9310b50873316f6147
|
data/lib/browser/methods/ie.rb
CHANGED
@@ -23,11 +23,11 @@ class Browser
|
|
23
23
|
end
|
24
24
|
|
25
25
|
def msie_full_version
|
26
|
-
ua.match(MSIE) && ($1 || $2)
|
26
|
+
(ua.match(MSIE) && ($1 || $2)) || "0.0"
|
27
27
|
end
|
28
28
|
|
29
29
|
def msie_version
|
30
|
-
msie_full_version.split(".").first
|
30
|
+
msie_full_version.to_s.split(".").first || "0"
|
31
31
|
end
|
32
32
|
|
33
33
|
# Return the trident version.
|
data/lib/browser/version.rb
CHANGED
data/test/browser_spec.rb
CHANGED
@@ -878,6 +878,45 @@ describe Browser do
|
|
878
878
|
refute @browser.safari?
|
879
879
|
end
|
880
880
|
|
881
|
+
it "detects IE without Trident" do
|
882
|
+
@browser.ua = $ua["IE_WITHOUT_TRIDENT"]
|
883
|
+
|
884
|
+
assert_equal :ie, @browser.id
|
885
|
+
assert_equal "Internet Explorer", @browser.name
|
886
|
+
assert_equal "0.0", @browser.msie_full_version
|
887
|
+
assert_equal "0", @browser.msie_version
|
888
|
+
assert_equal "0.0", @browser.full_version
|
889
|
+
assert_equal "0", @browser.version
|
890
|
+
refute @browser.windows10?
|
891
|
+
refute @browser.windows_phone?
|
892
|
+
refute @browser.edge?
|
893
|
+
refute @browser.modern?
|
894
|
+
refute @browser.mobile?
|
895
|
+
refute @browser.webkit?
|
896
|
+
refute @browser.chrome?
|
897
|
+
refute @browser.safari?
|
898
|
+
end
|
899
|
+
|
900
|
+
it "detects Daumoa" do
|
901
|
+
@browser.ua = $ua["DAUMOA"]
|
902
|
+
|
903
|
+
assert_equal :ie, @browser.id
|
904
|
+
assert_equal "Internet Explorer", @browser.name
|
905
|
+
assert_equal "0.0", @browser.msie_full_version
|
906
|
+
assert_equal "0", @browser.msie_version
|
907
|
+
assert_equal "0.0", @browser.full_version
|
908
|
+
assert_equal "0", @browser.version
|
909
|
+
assert @browser.ie?
|
910
|
+
refute @browser.windows10?
|
911
|
+
refute @browser.windows_phone?
|
912
|
+
refute @browser.edge?
|
913
|
+
refute @browser.modern?
|
914
|
+
refute @browser.mobile?
|
915
|
+
refute @browser.webkit?
|
916
|
+
refute @browser.chrome?
|
917
|
+
refute @browser.safari?
|
918
|
+
end
|
919
|
+
|
881
920
|
it "detects kindle monochrome" do
|
882
921
|
@browser.ua = $ua["KINDLE"]
|
883
922
|
|
data/test/ua.yml
CHANGED
@@ -23,6 +23,8 @@ FIREFOX_TABLET: 'Mozilla/5.0 (Android; Tablet; rv:14.0) Gecko/14.0 Firefox/14.0'
|
|
23
23
|
GOOGLE_BOT: 'Mozilla/5.0 (compatible; Googlebot/2.1; +http://www.google.com/bot.html)'
|
24
24
|
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'
|
25
25
|
GOOGLE_STRUCTURED_DATA_TESTING_TOOL: 'Mozilla/5.0 (compatible; X11; Linux x86_64; Google-StructuredDataTestingTool; +http://www.google.com/webmasters/tools/richsnippets)'
|
26
|
+
DAUMOA: Mozilla/5.0 (compatible; MSIE or Firefox mutant; not on Windows server;) Daumoa 4.0
|
27
|
+
IE_WITHOUT_TRIDENT: Mozilla/4.0 (compatible; MSIE8.0; Windows NT 6.0) .NET CLR 2.0.50727)
|
26
28
|
IE10: 'Mozilla/5.0 (compatible; MSIE 10.0; Windows NT 6.1; Trident/6.0; EIE10;ENUSMSN)'
|
27
29
|
IE10_COMPAT: 'Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 6.1; Trident/6.0; SLCC2; .NET CLR 2.0.50727; .NET CLR 3.5.30729; .NET CLR 3.0.30729; Media Center PC 6.0; .NET4.0C; EIE10;ENUSMSN)'
|
28
30
|
IE10_X64_WINX64: 'Mozilla/5.0 (compatible; MSIE 10.0; Windows NT 6.2; Win64; x64; Trident/6.0)'
|
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: 1.0.
|
4
|
+
version: 1.0.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Nando Vieira
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-08-
|
11
|
+
date: 2015-08-25 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -175,7 +175,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
175
175
|
version: '0'
|
176
176
|
requirements: []
|
177
177
|
rubyforge_project:
|
178
|
-
rubygems_version: 2.4.5
|
178
|
+
rubygems_version: 2.4.5
|
179
179
|
signing_key:
|
180
180
|
specification_version: 4
|
181
181
|
summary: Do some browser detection with Ruby.
|