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
@@ -1,106 +1,84 @@
|
|
1
1
|
require "test_helper"
|
2
2
|
|
3
3
|
class BlackberryTest < Minitest::Test
|
4
|
-
setup do
|
5
|
-
@browser = Browser.new
|
6
|
-
end
|
7
|
-
|
8
4
|
test "detects blackberry" do
|
9
|
-
|
10
|
-
|
11
|
-
assert_equal "BlackBerry",
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
assert_equal "4
|
17
|
-
assert_equal "4", @browser.version
|
5
|
+
browser = Browser.new(Browser["BLACKBERRY"])
|
6
|
+
|
7
|
+
assert_equal "BlackBerry", browser.name
|
8
|
+
refute browser.device.tablet?
|
9
|
+
assert browser.device.mobile?
|
10
|
+
refute browser.modern?
|
11
|
+
assert_equal "4.1.0", browser.full_version
|
12
|
+
assert_equal "4", browser.version
|
18
13
|
end
|
19
14
|
|
20
15
|
test "detects blackberry4" do
|
21
|
-
|
22
|
-
|
23
|
-
assert_equal "BlackBerry",
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
assert @browser.mobile?
|
28
|
-
refute @browser.modern?
|
29
|
-
assert_equal "4.2.1", @browser.full_version
|
30
|
-
assert_equal "4", @browser.version
|
16
|
+
browser = Browser.new(Browser["BLACKBERRY4"])
|
17
|
+
|
18
|
+
assert_equal "BlackBerry", browser.name
|
19
|
+
refute browser.modern?
|
20
|
+
assert_equal "4.2.1", browser.full_version
|
21
|
+
assert_equal "4", browser.version
|
31
22
|
end
|
32
23
|
|
33
24
|
test "detects blackberry5" do
|
34
|
-
|
35
|
-
|
36
|
-
assert_equal "BlackBerry",
|
37
|
-
|
38
|
-
|
39
|
-
refute
|
40
|
-
|
41
|
-
|
42
|
-
assert_equal "5.0.0.93", @browser.full_version
|
43
|
-
assert_equal "5", @browser.version
|
25
|
+
browser = Browser.new(Browser["BLACKBERRY5"])
|
26
|
+
|
27
|
+
assert_equal "BlackBerry", browser.name
|
28
|
+
refute browser.device.tablet?
|
29
|
+
assert browser.device.mobile?
|
30
|
+
refute browser.modern?
|
31
|
+
assert_equal "5.0.0.93", browser.full_version
|
32
|
+
assert_equal "5", browser.version
|
44
33
|
end
|
45
34
|
|
46
35
|
test "detects blackberry6" do
|
47
|
-
|
48
|
-
|
49
|
-
assert_equal "
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
assert_equal "534.11", @browser.full_version
|
56
|
-
assert_equal "534", @browser.version
|
36
|
+
browser = Browser.new(Browser["BLACKBERRY6"])
|
37
|
+
|
38
|
+
assert_equal "BlackBerry", browser.name
|
39
|
+
refute browser.device.tablet?
|
40
|
+
assert browser.device.mobile?
|
41
|
+
assert browser.modern?
|
42
|
+
assert_equal "6.0.0.141", browser.full_version
|
43
|
+
assert_equal "6", browser.version
|
57
44
|
end
|
58
45
|
|
59
46
|
test "detects blackberry7" do
|
60
|
-
|
61
|
-
|
62
|
-
assert_equal "
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
assert_equal "534.11", @browser.full_version
|
69
|
-
assert_equal "534", @browser.version
|
47
|
+
browser = Browser.new(Browser["BLACKBERRY7"])
|
48
|
+
|
49
|
+
assert_equal "BlackBerry", browser.name
|
50
|
+
refute browser.device.tablet?
|
51
|
+
assert browser.device.mobile?
|
52
|
+
assert browser.modern?
|
53
|
+
assert_equal "7.0.0.1", browser.full_version
|
54
|
+
assert_equal "7", browser.version
|
70
55
|
end
|
71
56
|
|
72
57
|
test "detects blackberry10" do
|
73
|
-
|
74
|
-
|
75
|
-
assert_equal "
|
76
|
-
|
77
|
-
assert
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
assert_equal "10.0.9.1675", @browser.full_version
|
82
|
-
assert_equal "10", @browser.version
|
58
|
+
browser = Browser.new(Browser["BLACKBERRY10"])
|
59
|
+
|
60
|
+
assert_equal "BlackBerry", browser.name
|
61
|
+
refute browser.device.tablet?
|
62
|
+
assert browser.device.mobile?
|
63
|
+
assert browser.modern?
|
64
|
+
assert_equal "10.0.9.1675", browser.full_version
|
65
|
+
assert_equal "10", browser.version
|
83
66
|
end
|
84
67
|
|
85
68
|
test "detects blackberry playbook tablet" do
|
86
|
-
|
69
|
+
browser = Browser.new(Browser["PLAYBOOK"])
|
87
70
|
|
88
|
-
refute
|
89
|
-
assert
|
90
|
-
refute
|
91
|
-
|
92
|
-
assert_equal "7.2.1.0", @browser.full_version
|
93
|
-
assert_equal "7", @browser.version
|
94
|
-
end
|
71
|
+
refute browser.platform.android?
|
72
|
+
assert browser.device.tablet?
|
73
|
+
refute browser.device.mobile?
|
95
74
|
|
96
|
-
|
97
|
-
|
98
|
-
assert_deprecated(message, __FILE__, __LINE__) { @browser.blackberry10? }
|
75
|
+
assert_equal "7.2.1.0", browser.full_version
|
76
|
+
assert_equal "7", browser.version
|
99
77
|
end
|
100
78
|
|
101
79
|
test "don't detect as two different versions" do
|
102
|
-
|
103
|
-
assert
|
104
|
-
refute
|
80
|
+
browser = Browser.new(Browser["BLACKBERRY10"])
|
81
|
+
assert browser.platform.blackberry?("~> 10.0")
|
82
|
+
refute browser.platform.blackberry?("~> 7.0")
|
105
83
|
end
|
106
84
|
end
|
data/test/unit/bots_test.rb
CHANGED
@@ -1,121 +1,89 @@
|
|
1
1
|
require "test_helper"
|
2
2
|
|
3
3
|
class BotsTest < Minitest::Test
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
test "detects bots" do
|
9
|
-
%w[
|
10
|
-
APPLE_BOT
|
11
|
-
DOMAINAREANIMATOR
|
12
|
-
DOT_BOT
|
13
|
-
FACEBOOK_BOT
|
14
|
-
GOOGLE_BOT
|
15
|
-
GRAPESHOT
|
16
|
-
LINKDEXBOT
|
17
|
-
LOAD_TIME_BOT
|
18
|
-
MAIL_RU
|
19
|
-
MEGAINDEX_RU
|
20
|
-
MSN_BOT
|
21
|
-
QUERYSEEKER
|
22
|
-
SCRAPY
|
23
|
-
SEOKICKS
|
24
|
-
TINEYE
|
25
|
-
SISTRIX
|
26
|
-
YANDEX_DIRECT
|
27
|
-
YANDEX_METRIKA
|
28
|
-
].each do |key|
|
29
|
-
@browser.ua = $ua[key]
|
30
|
-
assert @browser.bot?, "#{$ua[key]} should be a bot"
|
4
|
+
Browser.bot_user_agents.each do |key, ua|
|
5
|
+
test "detect #{key} as bot" do
|
6
|
+
browser = Browser.new(ua)
|
7
|
+
assert browser.bot?
|
31
8
|
end
|
32
|
-
|
33
|
-
@browser.ua = $ua["CHROME"]
|
34
|
-
refute @browser.bot?
|
35
9
|
end
|
36
10
|
|
37
|
-
test "
|
38
|
-
|
39
|
-
|
11
|
+
test "don't detect as bot" do
|
12
|
+
browser = Browser.new(Browser["CHROME"])
|
13
|
+
refute browser.bot?
|
40
14
|
end
|
41
15
|
|
42
16
|
test "doesn't consider empty UA as bot" do
|
43
|
-
|
44
|
-
refute
|
17
|
+
browser = Browser.new("")
|
18
|
+
refute browser.bot?
|
45
19
|
end
|
46
20
|
|
47
21
|
test "allows setting empty string as bots" do
|
48
|
-
Browser::
|
49
|
-
|
22
|
+
Browser::Bot.detect_empty_ua!
|
23
|
+
browser = Browser.new("")
|
50
24
|
|
51
|
-
assert
|
25
|
+
assert browser.bot?
|
52
26
|
end
|
53
27
|
|
54
28
|
test "doesn't detect mozilla as a bot when considering empty UA" do
|
55
|
-
Browser::
|
56
|
-
|
29
|
+
Browser::Bot.detect_empty_ua!
|
30
|
+
browser = Browser.new("Mozilla")
|
57
31
|
|
58
|
-
refute
|
32
|
+
refute browser.bot?
|
59
33
|
end
|
60
34
|
|
61
35
|
test "returns bot name" do
|
62
|
-
|
63
|
-
assert_equal
|
36
|
+
browser = Browser.new(Browser["GOOGLE_BOT"])
|
37
|
+
assert_equal "Google Bot", browser.bot.name
|
64
38
|
|
65
|
-
|
66
|
-
assert_equal
|
39
|
+
browser = Browser.new(Browser["FACEBOOK_BOT"])
|
40
|
+
assert_equal "Facebook Bot", browser.bot.name
|
67
41
|
end
|
68
42
|
|
69
43
|
test "returns bot name (empty string ua detection enabled)" do
|
70
|
-
Browser::
|
71
|
-
|
44
|
+
Browser::Bot.detect_empty_ua!
|
45
|
+
browser = Browser.new("")
|
72
46
|
|
73
|
-
assert_equal
|
47
|
+
assert_equal browser.bot.name, "Generic Bot"
|
74
48
|
end
|
75
49
|
|
76
50
|
test "returns nil for non-bots" do
|
77
|
-
|
78
|
-
|
51
|
+
browser = Browser.new(Browser["CHROME"])
|
52
|
+
assert_nil browser.bot.name
|
79
53
|
end
|
80
54
|
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
BINGBOT
|
86
|
-
DUCKDUCKGO
|
87
|
-
GOOGLE_BOT
|
88
|
-
YAHOO_SLURP
|
89
|
-
].each do |key|
|
90
|
-
@browser.ua = $ua[key]
|
91
|
-
assert @browser.search_engine?, "#{$ua[key]} should be a search engine"
|
55
|
+
Browser.search_engine_user_agents.each do |key, ua|
|
56
|
+
test "detects #{key} as search engine" do
|
57
|
+
browser = Browser.new(ua)
|
58
|
+
assert browser.bot.search_engine?
|
92
59
|
end
|
93
60
|
end
|
94
61
|
|
95
|
-
test "detects
|
96
|
-
|
97
|
-
|
98
|
-
|
62
|
+
test "detects Daumoa" do
|
63
|
+
browser = Browser.new(Browser["DAUMOA"])
|
64
|
+
|
65
|
+
assert_equal :ie, browser.id
|
66
|
+
assert_equal "Internet Explorer", browser.name
|
67
|
+
assert_equal "0.0", browser.msie_full_version
|
68
|
+
assert_equal "0", browser.msie_version
|
69
|
+
assert_equal "0.0", browser.full_version
|
70
|
+
assert_equal "0", browser.version
|
71
|
+
assert browser.ie?
|
72
|
+
assert browser.bot?
|
73
|
+
refute browser.platform.windows10?
|
74
|
+
refute browser.platform.windows_phone?
|
75
|
+
refute browser.edge?
|
76
|
+
refute browser.modern?
|
77
|
+
refute browser.device.mobile?
|
78
|
+
refute browser.webkit?
|
79
|
+
refute browser.chrome?
|
80
|
+
refute browser.safari?
|
99
81
|
end
|
100
82
|
|
101
|
-
test "
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
assert_equal "0.0", @browser.msie_full_version
|
107
|
-
assert_equal "0", @browser.msie_version
|
108
|
-
assert_equal "0.0", @browser.full_version
|
109
|
-
assert_equal "0", @browser.version
|
110
|
-
assert @browser.ie?
|
111
|
-
assert @browser.bot?
|
112
|
-
refute @browser.windows10?
|
113
|
-
refute @browser.windows_phone?
|
114
|
-
refute @browser.edge?
|
115
|
-
refute @browser.modern?
|
116
|
-
refute @browser.mobile?
|
117
|
-
refute @browser.webkit?
|
118
|
-
refute @browser.chrome?
|
119
|
-
refute @browser.safari?
|
83
|
+
test "custom android user agent (#144)" do
|
84
|
+
browser = Browser.new(Browser["CUSTOM_APP"])
|
85
|
+
|
86
|
+
assert browser.platform.android?
|
87
|
+
refute browser.bot?
|
120
88
|
end
|
121
89
|
end
|
data/test/unit/chrome_test.rb
CHANGED
@@ -1,60 +1,66 @@
|
|
1
1
|
require "test_helper"
|
2
2
|
|
3
3
|
class ChromeTest < Minitest::Test
|
4
|
-
setup do
|
5
|
-
@browser = Browser.new
|
6
|
-
end
|
7
|
-
|
8
4
|
test "detects chrome" do
|
9
|
-
|
10
|
-
|
11
|
-
assert_equal "Chrome",
|
12
|
-
assert
|
13
|
-
refute
|
14
|
-
assert
|
15
|
-
assert
|
16
|
-
assert_equal "5.0.375.99",
|
17
|
-
assert_equal "5",
|
5
|
+
browser = Browser.new(Browser["CHROME"])
|
6
|
+
|
7
|
+
assert_equal "Chrome", browser.name
|
8
|
+
assert browser.chrome?
|
9
|
+
refute browser.safari?
|
10
|
+
assert browser.webkit?
|
11
|
+
assert browser.modern?
|
12
|
+
assert_equal "5.0.375.99", browser.full_version
|
13
|
+
assert_equal "5", browser.version
|
18
14
|
end
|
19
15
|
|
20
16
|
test "detects mobile chrome" do
|
21
|
-
|
22
|
-
|
23
|
-
assert_equal "Chrome",
|
24
|
-
assert
|
25
|
-
refute
|
26
|
-
assert
|
27
|
-
assert
|
28
|
-
assert_equal "19.0.1084.60",
|
29
|
-
assert_equal "19",
|
17
|
+
browser = Browser.new(Browser["MOBILE_CHROME"])
|
18
|
+
|
19
|
+
assert_equal "Chrome", browser.name
|
20
|
+
assert browser.chrome?
|
21
|
+
refute browser.safari?
|
22
|
+
assert browser.webkit?
|
23
|
+
assert browser.modern?
|
24
|
+
assert_equal "19.0.1084.60", browser.full_version
|
25
|
+
assert_equal "19", browser.version
|
30
26
|
end
|
31
27
|
|
32
28
|
test "detects samsung chrome" do
|
33
|
-
|
34
|
-
|
35
|
-
assert_equal "Chrome",
|
36
|
-
assert
|
37
|
-
assert
|
38
|
-
refute
|
39
|
-
assert
|
40
|
-
assert
|
41
|
-
assert_equal "28.0.1500.94",
|
42
|
-
assert_equal "28",
|
29
|
+
browser = Browser.new(Browser["SAMSUNG_CHROME"])
|
30
|
+
|
31
|
+
assert_equal "Chrome", browser.name
|
32
|
+
assert browser.chrome?
|
33
|
+
assert browser.platform.android?
|
34
|
+
refute browser.safari?
|
35
|
+
assert browser.webkit?
|
36
|
+
assert browser.modern?
|
37
|
+
assert_equal "28.0.1500.94", browser.full_version
|
38
|
+
assert_equal "28", browser.version
|
43
39
|
end
|
44
40
|
|
45
41
|
test "detects chrome os" do
|
46
|
-
|
47
|
-
assert
|
42
|
+
browser = Browser.new(Browser["CHROME_OS"])
|
43
|
+
assert browser.platform.chrome_os?
|
48
44
|
end
|
49
45
|
|
50
46
|
test "detects yandex browser" do
|
51
|
-
|
52
|
-
|
53
|
-
assert
|
54
|
-
assert
|
55
|
-
refute
|
56
|
-
assert
|
57
|
-
assert_equal "41.0.2272.118",
|
58
|
-
assert_equal "41",
|
47
|
+
browser = Browser.new(Browser["YANDEX_BROWSER"])
|
48
|
+
|
49
|
+
assert browser.yandex?
|
50
|
+
assert browser.chrome?
|
51
|
+
refute browser.safari?
|
52
|
+
assert browser.webkit?
|
53
|
+
assert_equal "41.0.2272.118", browser.full_version
|
54
|
+
assert_equal "41", browser.version
|
55
|
+
end
|
56
|
+
|
57
|
+
test "detects chrome frame" do
|
58
|
+
browser = Browser.new(Browser["IE9_CHROME_FRAME"])
|
59
|
+
|
60
|
+
assert browser.chrome?
|
61
|
+
refute browser.safari?
|
62
|
+
assert browser.webkit?
|
63
|
+
assert_equal "26.0.1410.43", browser.full_version
|
64
|
+
assert_equal "26", browser.version
|
59
65
|
end
|
60
66
|
end
|
data/test/unit/console_test.rb
CHANGED
@@ -1,71 +1,13 @@
|
|
1
1
|
require "test_helper"
|
2
2
|
|
3
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
4
|
test "detects psp" do
|
55
|
-
|
56
|
-
|
57
|
-
assert_equal "PlayStation Portable", @browser.name
|
58
|
-
assert @browser.psp?
|
59
|
-
refute @browser.psp_vita?
|
60
|
-
assert @browser.mobile?
|
5
|
+
browser = Browser.new(Browser["PSP"])
|
6
|
+
assert_equal "Generic Browser", browser.name
|
61
7
|
end
|
62
8
|
|
63
9
|
test "detects psp vita" do
|
64
|
-
|
65
|
-
|
66
|
-
assert_equal "PlayStation Portable", @browser.name
|
67
|
-
assert @browser.psp?
|
68
|
-
assert @browser.psp_vita?
|
69
|
-
assert @browser.mobile?
|
10
|
+
browser = Browser.new(Browser["PSP_VITA"])
|
11
|
+
assert_equal "Generic Browser", browser.name
|
70
12
|
end
|
71
13
|
end
|