browser 1.1.0 → 2.0.0.rc1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.bundle/config +2 -0
- data/.hound.yml +26 -6
- data/.rubocop.yml +26 -6
- data/CHANGELOG.md +10 -0
- data/README.md +177 -41
- data/Rakefile +1 -1
- data/bin/rake +16 -0
- data/bot_exceptions.yml +1 -0
- data/bots.yml +188 -192
- data/browser.gemspec +14 -28
- data/languages.yml +54 -54
- data/lib/browser.rb +82 -202
- data/lib/browser/accept_language.rb +47 -0
- data/lib/browser/action_controller.rb +1 -1
- data/lib/browser/base.rb +159 -0
- data/lib/browser/blackberry.rb +21 -0
- data/lib/browser/bot.rb +63 -0
- data/lib/browser/chrome.rb +23 -0
- data/lib/browser/detect_version.rb +19 -0
- data/lib/browser/device.rb +175 -0
- data/lib/browser/device/base.rb +11 -0
- data/lib/browser/device/blackberry_playbook.rb +17 -0
- data/lib/browser/device/ipad.rb +17 -0
- data/lib/browser/device/iphone.rb +17 -0
- data/lib/browser/device/ipod_touch.rb +17 -0
- data/lib/browser/device/kindle.rb +17 -0
- data/lib/browser/device/kindle_fire.rb +17 -0
- data/lib/browser/device/playstation3.rb +17 -0
- data/lib/browser/device/playstation4.rb +17 -0
- data/lib/browser/device/psp.rb +17 -0
- data/lib/browser/device/psvita.rb +17 -0
- data/lib/browser/device/surface.rb +23 -0
- data/lib/browser/device/tv.rb +17 -0
- data/lib/browser/device/unknown.rb +17 -0
- data/lib/browser/device/wii.rb +17 -0
- data/lib/browser/device/wiiu.rb +17 -0
- data/lib/browser/device/xbox_360.rb +17 -0
- data/lib/browser/device/xbox_one.rb +17 -0
- data/lib/browser/edge.rb +19 -0
- data/lib/browser/firefox.rb +19 -0
- data/lib/browser/generic.rb +32 -0
- data/lib/browser/internet_explorer.rb +61 -0
- data/lib/browser/meta/base.rb +1 -1
- data/lib/browser/meta/device.rb +9 -0
- data/lib/browser/meta/generic_browser.rb +1 -1
- data/lib/browser/meta/id.rb +1 -1
- data/lib/browser/meta/ie.rb +1 -1
- data/lib/browser/meta/ios.rb +2 -2
- data/lib/browser/meta/mobile.rb +2 -2
- data/lib/browser/meta/modern.rb +1 -1
- data/lib/browser/meta/platform.rb +2 -2
- data/lib/browser/meta/proxy.rb +1 -1
- data/lib/browser/meta/safari.rb +1 -1
- data/lib/browser/meta/tablet.rb +9 -0
- data/lib/browser/meta/webkit.rb +1 -1
- data/lib/browser/middleware.rb +1 -1
- data/lib/browser/middleware/context.rb +2 -2
- data/lib/browser/middleware/context/additions.rb +1 -1
- data/lib/browser/middleware/context/url_methods.rb +3 -3
- data/lib/browser/nokia.rb +19 -0
- data/lib/browser/opera.rb +19 -0
- data/lib/browser/phantom_js.rb +19 -0
- data/lib/browser/platform.rb +152 -0
- data/lib/browser/platform/adobe_air.rb +21 -0
- data/lib/browser/platform/android.rb +21 -0
- data/lib/browser/platform/base.rb +15 -0
- data/lib/browser/platform/blackberry.rb +21 -0
- data/lib/browser/platform/chrome_os.rb +21 -0
- data/lib/browser/platform/firefox_os.rb +21 -0
- data/lib/browser/platform/ios.rb +28 -0
- data/lib/browser/platform/linux.rb +21 -0
- data/lib/browser/platform/mac.rb +21 -0
- data/lib/browser/platform/other.rb +21 -0
- data/lib/browser/platform/windows.rb +21 -0
- data/lib/browser/platform/windows_mobile.rb +21 -0
- data/lib/browser/platform/windows_phone.rb +21 -0
- data/lib/browser/rails.rb +3 -2
- data/lib/browser/safari.rb +22 -0
- data/lib/browser/testing.rb +23 -0
- data/lib/browser/uc_browser.rb +19 -0
- data/lib/browser/version.rb +2 -7
- data/search_engines.yml +5 -5
- data/test/browser_test.rb +71 -172
- data/test/middleware_test.rb +7 -7
- data/test/sample_app.rb +3 -3
- data/test/test_helper.rb +11 -10
- data/test/ua.yml +15 -26
- data/test/ua_bots.yml +27 -0
- data/test/ua_search_engines.yml +6 -0
- data/test/unit/accept_language_test.rb +92 -0
- data/test/unit/adobe_air_test.rb +5 -10
- data/test/unit/android_test.rb +44 -49
- data/test/unit/blackberry_test.rb +55 -77
- data/test/unit/bots_test.rb +52 -84
- data/test/unit/chrome_test.rb +48 -42
- data/test/unit/console_test.rb +4 -62
- data/test/unit/device_test.rb +193 -0
- data/test/unit/firefox_test.rb +32 -27
- data/test/unit/ie_test.rb +223 -238
- data/test/unit/ios_app_test.rb +3 -3
- data/test/unit/ios_test.rb +87 -94
- data/test/unit/kindle_test.rb +10 -24
- data/test/unit/nokia_test.rb +3 -7
- data/test/unit/opera_test.rb +20 -30
- data/test/unit/platform_test.rb +161 -0
- data/test/unit/proxy_test.rb +3 -3
- data/test/unit/safari_test.rb +66 -0
- data/test/unit/uc_browser_test.rb +3 -7
- data/test/unit/windows_phone_test.rb +19 -40
- data/test/unit/windows_test.rb +32 -34
- metadata +73 -28
- data/lib/browser/methods/blackberry.rb +0 -51
- data/lib/browser/methods/bots.rb +0 -35
- data/lib/browser/methods/consoles.rb +0 -43
- data/lib/browser/methods/devices.rb +0 -41
- data/lib/browser/methods/ie.rb +0 -99
- data/lib/browser/methods/language.rb +0 -16
- data/lib/browser/methods/mobile.rb +0 -35
- data/lib/browser/methods/platform.rb +0 -152
- data/lib/browser/methods/proxy.rb +0 -8
- data/lib/browser/methods/tv.rb +0 -8
data/test/unit/ios_app_test.rb
CHANGED
@@ -1,10 +1,10 @@
|
|
1
1
|
require "test_helper"
|
2
2
|
|
3
3
|
class IosAppTest < Minitest::Test
|
4
|
-
let(:browser) { Browser.new(
|
4
|
+
let(:browser) { Browser.new(Browser["IOS_WEBVIEW"]) }
|
5
5
|
|
6
6
|
test "detect as ios" do
|
7
|
-
assert browser.ios?
|
7
|
+
assert browser.platform.ios?
|
8
8
|
end
|
9
9
|
|
10
10
|
test "don't detect as safari" do
|
@@ -12,6 +12,6 @@ class IosAppTest < Minitest::Test
|
|
12
12
|
end
|
13
13
|
|
14
14
|
test "detect as webview" do
|
15
|
-
assert browser.ios_webview?
|
15
|
+
assert browser.platform.ios_webview?
|
16
16
|
end
|
17
17
|
end
|
data/test/unit/ios_test.rb
CHANGED
@@ -1,143 +1,136 @@
|
|
1
1
|
require "test_helper"
|
2
2
|
|
3
3
|
class IosTest < Minitest::Test
|
4
|
-
setup do
|
5
|
-
@browser = Browser.new
|
6
|
-
end
|
7
|
-
|
8
4
|
test "detects iphone" do
|
9
|
-
|
10
|
-
|
11
|
-
assert_equal "
|
12
|
-
assert
|
13
|
-
assert
|
14
|
-
assert
|
15
|
-
assert
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
refute @browser.mac?
|
20
|
-
assert_equal "3.0", @browser.full_version
|
21
|
-
assert_equal "3", @browser.version
|
5
|
+
browser = Browser.new(Browser["IPHONE"])
|
6
|
+
|
7
|
+
assert_equal "Safari", browser.name
|
8
|
+
assert browser.safari?
|
9
|
+
assert browser.webkit?
|
10
|
+
assert browser.modern?
|
11
|
+
assert browser.platform.ios?
|
12
|
+
refute browser.platform.mac?
|
13
|
+
assert_equal "3.0", browser.full_version
|
14
|
+
assert_equal "3", browser.version
|
22
15
|
end
|
23
16
|
|
24
17
|
test "detects safari" do
|
25
|
-
|
26
|
-
|
27
|
-
assert_equal "Safari",
|
28
|
-
assert
|
29
|
-
assert
|
30
|
-
assert
|
31
|
-
assert_equal "5.0.1",
|
32
|
-
assert_equal "5",
|
18
|
+
browser = Browser.new(Browser["SAFARI"])
|
19
|
+
|
20
|
+
assert_equal "Safari", browser.name
|
21
|
+
assert browser.safari?
|
22
|
+
assert browser.webkit?
|
23
|
+
assert browser.modern?
|
24
|
+
assert_equal "5.0.1", browser.full_version
|
25
|
+
assert_equal "5", browser.version
|
33
26
|
end
|
34
27
|
|
35
28
|
test "detects safari in webapp mode" do
|
36
|
-
|
37
|
-
refute
|
38
|
-
assert
|
29
|
+
browser = Browser.new(Browser["SAFARI_IPAD_WEBAPP_MODE"])
|
30
|
+
refute browser.safari?
|
31
|
+
assert browser.platform.ios_webview?
|
39
32
|
|
40
|
-
|
41
|
-
refute
|
42
|
-
assert
|
33
|
+
browser = Browser.new(Browser["SAFARI_IPHONE_WEBAPP_MODE"])
|
34
|
+
refute browser.safari?
|
35
|
+
assert browser.platform.ios_webview?
|
43
36
|
end
|
44
37
|
|
45
38
|
test "detects ipod" do
|
46
|
-
|
47
|
-
|
48
|
-
assert_equal "
|
49
|
-
assert
|
50
|
-
assert
|
51
|
-
assert
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
refute @browser.mac?
|
57
|
-
assert_equal "3.0", @browser.full_version
|
58
|
-
assert_equal "3", @browser.version
|
39
|
+
browser = Browser.new(Browser["IPOD"])
|
40
|
+
|
41
|
+
assert_equal "Safari", browser.name
|
42
|
+
assert browser.safari?
|
43
|
+
assert browser.webkit?
|
44
|
+
assert browser.platform.ios?
|
45
|
+
refute browser.device.tablet?
|
46
|
+
refute browser.platform.mac?
|
47
|
+
assert_equal "3.0", browser.full_version
|
48
|
+
assert_equal "3", browser.version
|
59
49
|
end
|
60
50
|
|
61
51
|
test "detects ipad" do
|
62
|
-
|
63
|
-
|
64
|
-
assert_equal "
|
65
|
-
assert
|
66
|
-
assert
|
67
|
-
assert
|
68
|
-
assert
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
refute @browser.mac?
|
73
|
-
assert_equal "4.0.4", @browser.full_version
|
74
|
-
assert_equal "4", @browser.version
|
52
|
+
browser = Browser.new(Browser["IPAD"])
|
53
|
+
|
54
|
+
assert_equal "Safari", browser.name
|
55
|
+
assert browser.safari?
|
56
|
+
assert browser.webkit?
|
57
|
+
assert browser.modern?
|
58
|
+
assert browser.platform.ios?
|
59
|
+
refute browser.platform.mac?
|
60
|
+
assert_equal "4.0.4", browser.full_version
|
61
|
+
assert_equal "4", browser.version
|
75
62
|
end
|
76
63
|
|
77
64
|
test "detects ios4" do
|
78
|
-
|
79
|
-
assert
|
80
|
-
assert
|
81
|
-
refute
|
65
|
+
browser = Browser.new(Browser["IOS4"])
|
66
|
+
assert browser.platform.ios?
|
67
|
+
assert browser.platform.ios?(4)
|
68
|
+
refute browser.platform.mac?
|
82
69
|
end
|
83
70
|
|
84
|
-
|
85
71
|
test "detects ios5" do
|
86
|
-
|
87
|
-
assert
|
88
|
-
assert
|
89
|
-
refute
|
72
|
+
browser = Browser.new(Browser["IOS5"])
|
73
|
+
assert browser.platform.ios?
|
74
|
+
assert browser.platform.ios?(5)
|
75
|
+
refute browser.platform.mac?
|
90
76
|
end
|
91
77
|
|
92
78
|
test "detects ios6" do
|
93
|
-
|
94
|
-
assert
|
95
|
-
assert
|
96
|
-
refute
|
79
|
+
browser = Browser.new(Browser["IOS6"])
|
80
|
+
assert browser.platform.ios?
|
81
|
+
assert browser.platform.ios?(6)
|
82
|
+
refute browser.platform.mac?
|
97
83
|
end
|
98
84
|
|
99
85
|
test "detects ios7" do
|
100
|
-
|
101
|
-
assert
|
102
|
-
assert
|
103
|
-
refute
|
86
|
+
browser = Browser.new(Browser["IOS7"])
|
87
|
+
assert browser.platform.ios?
|
88
|
+
assert browser.platform.ios?(7)
|
89
|
+
refute browser.platform.mac?
|
104
90
|
end
|
105
91
|
|
106
92
|
test "detects ios8" do
|
107
|
-
|
108
|
-
assert
|
109
|
-
assert
|
110
|
-
refute
|
93
|
+
browser = Browser.new(Browser["IOS8"])
|
94
|
+
assert browser.platform.ios?
|
95
|
+
assert browser.platform.ios?(8)
|
96
|
+
refute browser.platform.mac?
|
111
97
|
end
|
112
98
|
|
113
99
|
test "detects ios9" do
|
114
|
-
|
115
|
-
assert
|
116
|
-
assert
|
117
|
-
refute
|
100
|
+
browser = Browser.new(Browser["IOS9"])
|
101
|
+
assert browser.platform.ios?
|
102
|
+
assert browser.platform.ios?(9)
|
103
|
+
refute browser.platform.mac?
|
118
104
|
end
|
119
105
|
|
120
106
|
test "don't detect as two different versions" do
|
121
|
-
|
122
|
-
assert
|
123
|
-
refute
|
107
|
+
browser = Browser.new(Browser["IOS8"])
|
108
|
+
assert browser.platform.ios?(8)
|
109
|
+
refute browser.platform.ios?(7)
|
124
110
|
end
|
125
111
|
|
126
|
-
test "
|
127
|
-
|
128
|
-
|
129
|
-
end
|
130
|
-
|
131
|
-
test "returns string representation for ios" do
|
132
|
-
@browser.ua = $ua["IPHONE"]
|
133
|
-
meta = @browser.to_s
|
112
|
+
test "returns string representation for iphone" do
|
113
|
+
browser = Browser.new(Browser["IPHONE"])
|
114
|
+
meta = browser.to_s
|
134
115
|
|
135
|
-
assert meta.include?("iphone")
|
136
116
|
assert meta.include?("webkit")
|
137
117
|
assert meta.include?("ios")
|
138
118
|
assert meta.include?("safari")
|
139
119
|
assert meta.include?("safari3")
|
140
120
|
assert meta.include?("modern")
|
141
121
|
assert meta.include?("mobile")
|
122
|
+
refute meta.include?("tablet")
|
123
|
+
end
|
124
|
+
|
125
|
+
test "returns string representation for ipad" do
|
126
|
+
browser = Browser.new(Browser["IPAD"])
|
127
|
+
meta = browser.to_s
|
128
|
+
|
129
|
+
assert meta.include?("webkit")
|
130
|
+
assert meta.include?("ios")
|
131
|
+
assert meta.include?("safari")
|
132
|
+
assert meta.include?("modern")
|
133
|
+
assert meta.include?("tablet")
|
134
|
+
refute meta.include?("mobile")
|
142
135
|
end
|
143
136
|
end
|
data/test/unit/kindle_test.rb
CHANGED
@@ -1,41 +1,27 @@
|
|
1
1
|
require "test_helper"
|
2
2
|
|
3
3
|
class KindleTest < Minitest::Test
|
4
|
-
setup do
|
5
|
-
@browser = Browser.new
|
6
|
-
end
|
7
|
-
|
8
4
|
test "detects kindle monochrome" do
|
9
|
-
|
10
|
-
|
11
|
-
assert @browser.kindle?
|
12
|
-
assert @browser.webkit?
|
5
|
+
browser = Browser.new(Browser["KINDLE"])
|
6
|
+
assert browser.webkit?
|
13
7
|
end
|
14
8
|
|
15
9
|
test "detects kindle fire" do
|
16
|
-
|
17
|
-
|
18
|
-
assert @browser.kindle?
|
19
|
-
assert @browser.webkit?
|
10
|
+
browser = Browser.new(Browser["KINDLE_FIRE"])
|
11
|
+
assert browser.webkit?
|
20
12
|
end
|
21
13
|
|
22
14
|
test "detects kindle fire hd" do
|
23
|
-
|
15
|
+
browser = Browser.new(Browser["KINDLE_FIRE_HD"])
|
24
16
|
|
25
|
-
assert
|
26
|
-
assert
|
27
|
-
assert @browser.webkit?
|
28
|
-
assert @browser.modern?
|
29
|
-
refute @browser.mobile?
|
17
|
+
assert browser.webkit?
|
18
|
+
assert browser.modern?
|
30
19
|
end
|
31
20
|
|
32
21
|
test "detects kindle fire hd mobile" do
|
33
|
-
|
22
|
+
browser = Browser.new(Browser["KINDLE_FIRE_HD_MOBILE"])
|
34
23
|
|
35
|
-
assert
|
36
|
-
assert
|
37
|
-
assert @browser.webkit?
|
38
|
-
assert @browser.modern?
|
39
|
-
assert @browser.mobile?
|
24
|
+
assert browser.webkit?
|
25
|
+
assert browser.modern?
|
40
26
|
end
|
41
27
|
end
|
data/test/unit/nokia_test.rb
CHANGED
@@ -1,13 +1,9 @@
|
|
1
1
|
require "test_helper"
|
2
2
|
|
3
3
|
class NokiaTest < Minitest::Test
|
4
|
-
setup do
|
5
|
-
@browser = Browser.new(ua: $ua["NOKIA"])
|
6
|
-
end
|
7
|
-
|
8
4
|
test "detects Nokia S40" do
|
9
|
-
|
10
|
-
assert
|
11
|
-
assert_equal
|
5
|
+
browser = Browser.new(Browser["NOKIA"])
|
6
|
+
assert browser.nokia?
|
7
|
+
assert_equal "Nokia S40 Ovi Browser", browser.name
|
12
8
|
end
|
13
9
|
end
|
data/test/unit/opera_test.rb
CHANGED
@@ -1,46 +1,36 @@
|
|
1
1
|
require "test_helper"
|
2
2
|
|
3
3
|
class OperaTest < Minitest::Test
|
4
|
-
setup do
|
5
|
-
@browser = Browser.new
|
6
|
-
end
|
7
|
-
|
8
4
|
test "detects opera" do
|
9
|
-
|
5
|
+
browser = Browser.new(Browser["OPERA"])
|
10
6
|
|
11
|
-
assert_equal "Opera",
|
12
|
-
assert
|
13
|
-
refute
|
14
|
-
assert_equal "11.64",
|
15
|
-
assert_equal "11",
|
7
|
+
assert_equal "Opera", browser.name
|
8
|
+
assert browser.opera?
|
9
|
+
refute browser.modern?
|
10
|
+
assert_equal "11.64", browser.full_version
|
11
|
+
assert_equal "11", browser.version
|
16
12
|
end
|
17
13
|
|
18
14
|
test "detects opera next" do
|
19
|
-
|
20
|
-
|
21
|
-
assert_equal "Opera",
|
22
|
-
assert_equal :opera,
|
23
|
-
assert
|
24
|
-
assert
|
25
|
-
assert
|
26
|
-
refute
|
27
|
-
assert_equal "15.0.1147.44",
|
28
|
-
assert_equal "15",
|
15
|
+
browser = Browser.new(Browser["OPERA_NEXT"])
|
16
|
+
|
17
|
+
assert_equal "Opera", browser.name
|
18
|
+
assert_equal :opera, browser.id
|
19
|
+
assert browser.opera?
|
20
|
+
assert browser.webkit?
|
21
|
+
assert browser.modern?
|
22
|
+
refute browser.chrome?
|
23
|
+
assert_equal "15.0.1147.44", browser.full_version
|
24
|
+
assert_equal "15", browser.version
|
29
25
|
end
|
30
26
|
|
31
27
|
test "detects opera mini" do
|
32
|
-
|
33
|
-
|
34
|
-
assert @browser.opera_mini?
|
35
|
-
refute @browser.tablet?
|
36
|
-
assert @browser.mobile?
|
28
|
+
browser = Browser.new(Browser["OPERA_MINI"])
|
29
|
+
assert browser.opera_mini?
|
37
30
|
end
|
38
31
|
|
39
32
|
test "detects opera mobi" do
|
40
|
-
|
41
|
-
|
42
|
-
assert @browser.opera?
|
43
|
-
refute @browser.tablet?
|
44
|
-
assert @browser.mobile?
|
33
|
+
browser = Browser.new(Browser["OPERA_MOBI"])
|
34
|
+
assert browser.opera?
|
45
35
|
end
|
46
36
|
end
|
@@ -0,0 +1,161 @@
|
|
1
|
+
require "test_helper"
|
2
|
+
|
3
|
+
class PlatformTest < Minitest::Test
|
4
|
+
test "detect other" do
|
5
|
+
platform = Browser::Platform.new("Other")
|
6
|
+
|
7
|
+
assert_equal "Other", platform.name
|
8
|
+
assert_equal :other, platform.id
|
9
|
+
assert_equal "0", platform.version
|
10
|
+
end
|
11
|
+
|
12
|
+
test "detect ios (iPhone)" do
|
13
|
+
platform = Browser::Platform.new(Browser["IOS4"])
|
14
|
+
|
15
|
+
assert_equal "iOS (iPhone)", platform.name
|
16
|
+
assert_equal :ios, platform.id
|
17
|
+
assert platform.ios?
|
18
|
+
assert_equal "4", platform.version
|
19
|
+
end
|
20
|
+
|
21
|
+
test "detect ios (iPad)" do
|
22
|
+
platform = Browser::Platform.new(Browser["IOS9"])
|
23
|
+
|
24
|
+
assert_equal "iOS (iPad)", platform.name
|
25
|
+
assert_equal :ios, platform.id
|
26
|
+
assert platform.ios?
|
27
|
+
assert_equal "9", platform.version
|
28
|
+
end
|
29
|
+
|
30
|
+
test "detect ios (iPod Touch)" do
|
31
|
+
platform = Browser::Platform.new(Browser["IPOD"])
|
32
|
+
|
33
|
+
assert_equal "iOS (iPod)", platform.name
|
34
|
+
assert_equal :ios, platform.id
|
35
|
+
assert platform.ios?
|
36
|
+
assert_equal "0", platform.version
|
37
|
+
end
|
38
|
+
|
39
|
+
test "detect linux" do
|
40
|
+
platform = Browser::Platform.new(Browser["FIREFOX"])
|
41
|
+
|
42
|
+
assert_equal "Generic Linux", platform.name
|
43
|
+
assert_equal :linux, platform.id
|
44
|
+
assert platform.linux?
|
45
|
+
assert_equal "0", platform.version
|
46
|
+
end
|
47
|
+
|
48
|
+
test "detect mac" do
|
49
|
+
platform = Browser::Platform.new(Browser["SAFARI"])
|
50
|
+
|
51
|
+
assert_equal "Macintosh", platform.name
|
52
|
+
assert_equal :mac, platform.id
|
53
|
+
assert platform.mac?
|
54
|
+
assert_equal "0", platform.version
|
55
|
+
end
|
56
|
+
|
57
|
+
test "detect firefox os" do
|
58
|
+
platform = Browser::Platform.new(Browser["FIREFOX_OS"])
|
59
|
+
|
60
|
+
assert_equal "Firefox OS", platform.name
|
61
|
+
assert_equal :firefox_os, platform.id
|
62
|
+
assert platform.firefox_os?
|
63
|
+
assert_equal "0", platform.version
|
64
|
+
end
|
65
|
+
|
66
|
+
test "detect windows phone" do
|
67
|
+
platform = Browser::Platform.new(Browser["MS_EDGE_MOBILE"])
|
68
|
+
|
69
|
+
assert_equal "Windows Phone", platform.name
|
70
|
+
assert_equal :windows_phone, platform.id
|
71
|
+
assert platform.windows_phone?
|
72
|
+
assert_equal "10.0", platform.version
|
73
|
+
end
|
74
|
+
|
75
|
+
test "detect windows mobile" do
|
76
|
+
platform = Browser::Platform.new(Browser["WINDOWS_MOBILE"])
|
77
|
+
|
78
|
+
assert_equal "Windows Mobile", platform.name
|
79
|
+
assert_equal :windows_mobile, platform.id
|
80
|
+
assert platform.windows_mobile?
|
81
|
+
assert_equal "0", platform.version
|
82
|
+
end
|
83
|
+
|
84
|
+
test "detect blackberry 10" do
|
85
|
+
platform = Browser::Platform.new(Browser["BLACKBERRY10"])
|
86
|
+
|
87
|
+
assert_equal "BlackBerry", platform.name
|
88
|
+
assert_equal :blackberry, platform.id
|
89
|
+
assert platform.blackberry?
|
90
|
+
assert_equal "10.0.9.1675", platform.version
|
91
|
+
end
|
92
|
+
|
93
|
+
test "detect blackberry 4" do
|
94
|
+
platform = Browser::Platform.new(Browser["BLACKBERRY4"])
|
95
|
+
|
96
|
+
assert_equal "BlackBerry", platform.name
|
97
|
+
assert_equal :blackberry, platform.id
|
98
|
+
assert platform.blackberry?
|
99
|
+
assert_equal "4.2.1", platform.version
|
100
|
+
end
|
101
|
+
|
102
|
+
test "detect blackberry 4 (other)" do
|
103
|
+
platform = Browser::Platform.new(Browser["BLACKBERRY"])
|
104
|
+
|
105
|
+
assert_equal "BlackBerry", platform.name
|
106
|
+
assert_equal :blackberry, platform.id
|
107
|
+
assert platform.blackberry?
|
108
|
+
assert_equal "4.1.0", platform.version
|
109
|
+
end
|
110
|
+
|
111
|
+
test "detect blackberry 5" do
|
112
|
+
platform = Browser::Platform.new(Browser["BLACKBERRY5"])
|
113
|
+
|
114
|
+
assert_equal "BlackBerry", platform.name
|
115
|
+
assert_equal :blackberry, platform.id
|
116
|
+
assert platform.blackberry?
|
117
|
+
assert_equal "5.0.0.93", platform.version
|
118
|
+
end
|
119
|
+
|
120
|
+
test "detect blackberry 6" do
|
121
|
+
platform = Browser::Platform.new(Browser["BLACKBERRY6"])
|
122
|
+
|
123
|
+
assert_equal "BlackBerry", platform.name
|
124
|
+
assert_equal :blackberry, platform.id
|
125
|
+
assert platform.blackberry?
|
126
|
+
assert_equal "6.0.0.141", platform.version
|
127
|
+
end
|
128
|
+
|
129
|
+
test "detect blackberry 7" do
|
130
|
+
platform = Browser::Platform.new(Browser["BLACKBERRY7"])
|
131
|
+
|
132
|
+
assert_equal "BlackBerry", platform.name
|
133
|
+
assert_equal :blackberry, platform.id
|
134
|
+
assert platform.blackberry?
|
135
|
+
assert_equal "7.0.0.1", platform.version
|
136
|
+
end
|
137
|
+
|
138
|
+
test "detect android" do
|
139
|
+
platform = Browser::Platform.new(Browser["ANDROID_CUPCAKE"])
|
140
|
+
|
141
|
+
assert_equal "Android", platform.name
|
142
|
+
assert_equal :android, platform.id
|
143
|
+
assert platform.android?
|
144
|
+
assert_equal "1.5", platform.version
|
145
|
+
end
|
146
|
+
|
147
|
+
test "detect chrome os" do
|
148
|
+
platform = Browser::Platform.new(Browser["CHROME_OS"])
|
149
|
+
|
150
|
+
assert_equal "Chrome OS", platform.name
|
151
|
+
assert_equal :chrome_os, platform.id
|
152
|
+
assert platform.chrome_os?
|
153
|
+
assert_equal "3701.81.0", platform.version
|
154
|
+
end
|
155
|
+
|
156
|
+
test "detect adobe air" do
|
157
|
+
platform = Browser::Platform.new(Browser["ADOBE_AIR"])
|
158
|
+
|
159
|
+
assert platform.adobe_air?
|
160
|
+
end
|
161
|
+
end
|