device_detector 1.0.6 → 1.0.7
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +7 -0
- data/README.md +5 -5
- data/lib/device_detector/device.rb +82 -3
- data/lib/device_detector/os.rb +4 -2
- data/lib/device_detector/parser.rb +1 -1
- data/lib/device_detector/version.rb +1 -1
- data/lib/device_detector/version_extractor.rb +20 -1
- data/regexes/bots.yml +49 -6
- data/regexes/client/browsers.yml +170 -16
- data/regexes/client/libraries.yml +20 -1
- data/regexes/client/mediaplayers.yml +2 -2
- data/regexes/client/mobile_apps.yml +447 -13
- data/regexes/client/pim.yml +16 -1
- data/regexes/device/consoles.yml +7 -1
- data/regexes/device/mobiles.yml +3169 -912
- data/regexes/device/portable_media_player.yml +16 -6
- data/regexes/oss.yml +380 -467
- metadata +3 -164
- data/.gitignore +0 -14
- data/.rubocop.yml +0 -49
- data/.ruby-version +0 -1
- data/.travis.yml +0 -14
- data/Gemfile +0 -8
- data/Rakefile +0 -86
- data/device_detector.gemspec +0 -27
- data/spec/device_detector/bot_fixtures_spec.rb +0 -30
- data/spec/device_detector/client_fixtures_spec.rb +0 -31
- data/spec/device_detector/concrete_user_agent_spec.rb +0 -123
- data/spec/device_detector/detector_fixtures_spec.rb +0 -99
- data/spec/device_detector/device_fixtures_spec.rb +0 -36
- data/spec/device_detector/device_spec.rb +0 -147
- data/spec/device_detector/memory_cache_spec.rb +0 -148
- data/spec/device_detector/model_extractor_spec.rb +0 -63
- data/spec/device_detector/os_fixtures_spec.rb +0 -26
- data/spec/device_detector/version_extractor_spec.rb +0 -79
- data/spec/device_detector_spec.rb +0 -189
- data/spec/fixtures/client/browser.yml +0 -3935
- data/spec/fixtures/client/feed_reader.yml +0 -187
- data/spec/fixtures/client/library.yml +0 -253
- data/spec/fixtures/client/mediaplayer.yml +0 -193
- data/spec/fixtures/client/mobile_app.yml +0 -703
- data/spec/fixtures/client/pim.yml +0 -175
- data/spec/fixtures/detector/bots.yml +0 -4434
- data/spec/fixtures/detector/camera.yml +0 -127
- data/spec/fixtures/detector/car_browser.yml +0 -217
- data/spec/fixtures/detector/console.yml +0 -343
- data/spec/fixtures/detector/desktop.yml +0 -7580
- data/spec/fixtures/detector/feature_phone.yml +0 -1597
- data/spec/fixtures/detector/feed_reader.yml +0 -524
- data/spec/fixtures/detector/mediaplayer.yml +0 -306
- data/spec/fixtures/detector/mobile_apps.yml +0 -1233
- data/spec/fixtures/detector/peripheral.yml +0 -271
- data/spec/fixtures/detector/phablet.yml +0 -7366
- data/spec/fixtures/detector/portable_media_player.yml +0 -527
- data/spec/fixtures/detector/smart_display.yml +0 -235
- data/spec/fixtures/detector/smart_speaker.yml +0 -60
- data/spec/fixtures/detector/smartphone-1.yml +0 -9622
- data/spec/fixtures/detector/smartphone-10.yml +0 -8981
- data/spec/fixtures/detector/smartphone-11.yml +0 -8938
- data/spec/fixtures/detector/smartphone-12.yml +0 -8989
- data/spec/fixtures/detector/smartphone-13.yml +0 -9412
- data/spec/fixtures/detector/smartphone-14.yml +0 -9477
- data/spec/fixtures/detector/smartphone-15.yml +0 -9281
- data/spec/fixtures/detector/smartphone-16.yml +0 -9678
- data/spec/fixtures/detector/smartphone-17.yml +0 -9965
- data/spec/fixtures/detector/smartphone-18.yml +0 -9806
- data/spec/fixtures/detector/smartphone-19.yml +0 -9965
- data/spec/fixtures/detector/smartphone-2.yml +0 -12242
- data/spec/fixtures/detector/smartphone-20.yml +0 -9710
- data/spec/fixtures/detector/smartphone-21.yml +0 -8693
- data/spec/fixtures/detector/smartphone-22.yml +0 -10178
- data/spec/fixtures/detector/smartphone-23.yml +0 -9453
- data/spec/fixtures/detector/smartphone-24.yml +0 -9843
- data/spec/fixtures/detector/smartphone-25.yml +0 -9703
- data/spec/fixtures/detector/smartphone-26.yml +0 -10007
- data/spec/fixtures/detector/smartphone-27.yml +0 -4927
- data/spec/fixtures/detector/smartphone-3.yml +0 -9909
- data/spec/fixtures/detector/smartphone-4.yml +0 -8954
- data/spec/fixtures/detector/smartphone-5.yml +0 -8981
- data/spec/fixtures/detector/smartphone-6.yml +0 -8948
- data/spec/fixtures/detector/smartphone-7.yml +0 -8975
- data/spec/fixtures/detector/smartphone-8.yml +0 -9810
- data/spec/fixtures/detector/smartphone-9.yml +0 -8925
- data/spec/fixtures/detector/smartphone.yml +0 -9001
- data/spec/fixtures/detector/tablet-1.yml +0 -10155
- data/spec/fixtures/detector/tablet-2.yml +0 -9064
- data/spec/fixtures/detector/tablet-3.yml +0 -9035
- data/spec/fixtures/detector/tablet-4.yml +0 -9062
- data/spec/fixtures/detector/tablet-5.yml +0 -9273
- data/spec/fixtures/detector/tablet-6.yml +0 -4588
- data/spec/fixtures/detector/tablet.yml +0 -8979
- data/spec/fixtures/detector/tv-1.yml +0 -2501
- data/spec/fixtures/detector/tv.yml +0 -10045
- data/spec/fixtures/detector/unknown.yml +0 -3071
- data/spec/fixtures/detector/wearable.yml +0 -915
- data/spec/fixtures/device/camera.yml +0 -19
- data/spec/fixtures/device/car_browser.yml +0 -13
- data/spec/fixtures/device/console.yml +0 -79
- data/spec/fixtures/device/notebook.yml +0 -7
- data/spec/fixtures/parser/oss.yml +0 -2418
- data/spec/fixtures/parser/vendorfragments.yml +0 -168
- data/spec/spec_helper.rb +0 -9
@@ -1,189 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require_relative 'spec_helper'
|
4
|
-
|
5
|
-
describe DeviceDetector do
|
6
|
-
subject { DeviceDetector.new(user_agent) }
|
7
|
-
|
8
|
-
alias_method :client, :subject
|
9
|
-
|
10
|
-
describe 'known user agent' do
|
11
|
-
describe 'desktop chrome browser' do
|
12
|
-
let(:user_agent) { 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_8_5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/30.0.1599.69' }
|
13
|
-
|
14
|
-
describe '#name' do
|
15
|
-
it 'returns the name' do
|
16
|
-
value(client.name).must_equal 'Chrome'
|
17
|
-
end
|
18
|
-
end
|
19
|
-
|
20
|
-
describe '#full_version' do
|
21
|
-
it 'returns the full version' do
|
22
|
-
value(client.full_version).must_equal '30.0.1599.69'
|
23
|
-
end
|
24
|
-
end
|
25
|
-
|
26
|
-
describe '#os_family' do
|
27
|
-
it 'returns the operating system name' do
|
28
|
-
value(client.os_family).must_equal 'Mac'
|
29
|
-
end
|
30
|
-
end
|
31
|
-
|
32
|
-
describe '#os_name' do
|
33
|
-
it 'returns the operating system name' do
|
34
|
-
value(client.os_name).must_equal 'Mac'
|
35
|
-
end
|
36
|
-
end
|
37
|
-
|
38
|
-
describe '#os_full_version' do
|
39
|
-
it 'returns the operating system full version' do
|
40
|
-
value(client.os_full_version).must_equal '10.8.5'
|
41
|
-
end
|
42
|
-
end
|
43
|
-
|
44
|
-
describe '#known?' do
|
45
|
-
it 'returns true' do
|
46
|
-
value(client.known?).must_equal true
|
47
|
-
end
|
48
|
-
end
|
49
|
-
|
50
|
-
describe '#bot?' do
|
51
|
-
it 'returns false' do
|
52
|
-
value(client.bot?).must_equal false
|
53
|
-
end
|
54
|
-
end
|
55
|
-
|
56
|
-
describe '#bot_name' do
|
57
|
-
it 'returns nil' do
|
58
|
-
value(client.bot_name).must_be_nil
|
59
|
-
end
|
60
|
-
end
|
61
|
-
end
|
62
|
-
|
63
|
-
describe 'ubuntu linux' do
|
64
|
-
let(:user_agent) do
|
65
|
-
'Mozilla/5.0 (X11; Ubuntu; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/60.0.3112.101 Safari/537.36'
|
66
|
-
end
|
67
|
-
|
68
|
-
describe '#os_family' do
|
69
|
-
it 'returns the operating system name' do
|
70
|
-
value(client.os_family).must_equal 'GNU/Linux'
|
71
|
-
end
|
72
|
-
end
|
73
|
-
|
74
|
-
describe '#os_name' do
|
75
|
-
it 'returns the operating system name' do
|
76
|
-
value(client.os_name).must_equal 'Ubuntu'
|
77
|
-
end
|
78
|
-
end
|
79
|
-
end
|
80
|
-
|
81
|
-
describe 'firefox mobile phone' do
|
82
|
-
let(:user_agent) { 'Mozilla/5.0 (Android 7.0; Mobile; rv:53.0) Gecko/53.0 Firefox/53.0' }
|
83
|
-
|
84
|
-
it 'detects smartphone' do
|
85
|
-
value(client.device_type).must_equal 'smartphone'
|
86
|
-
end
|
87
|
-
end
|
88
|
-
|
89
|
-
describe 'firefox mobile tablet' do
|
90
|
-
let(:user_agent) { 'Mozilla/5.0 (Android 6.0.1; Tablet; rv:47.0) Gecko/47.0 Firefox/47.0' }
|
91
|
-
|
92
|
-
it 'detects tablet' do
|
93
|
-
value(client.device_type).must_equal 'tablet'
|
94
|
-
end
|
95
|
-
end
|
96
|
-
end
|
97
|
-
|
98
|
-
describe 'unknown user agent' do
|
99
|
-
let(:user_agent) { 'garbage123' }
|
100
|
-
|
101
|
-
describe '#name' do
|
102
|
-
it 'returns nil' do
|
103
|
-
value(client.name).must_be_nil
|
104
|
-
end
|
105
|
-
end
|
106
|
-
|
107
|
-
describe '#full_version' do
|
108
|
-
it 'returns nil' do
|
109
|
-
value(client.full_version).must_be_nil
|
110
|
-
end
|
111
|
-
end
|
112
|
-
|
113
|
-
describe '#os_name' do
|
114
|
-
it 'returns nil' do
|
115
|
-
value(client.os_name).must_be_nil
|
116
|
-
end
|
117
|
-
end
|
118
|
-
|
119
|
-
describe '#os_full_version' do
|
120
|
-
it 'returns nil' do
|
121
|
-
value(client.os_full_version).must_be_nil
|
122
|
-
end
|
123
|
-
end
|
124
|
-
|
125
|
-
describe '#known?' do
|
126
|
-
it 'returns false' do
|
127
|
-
value(client.known?).must_equal false
|
128
|
-
end
|
129
|
-
end
|
130
|
-
|
131
|
-
describe '#bot?' do
|
132
|
-
it 'returns false' do
|
133
|
-
value(client.bot?).must_equal false
|
134
|
-
end
|
135
|
-
end
|
136
|
-
|
137
|
-
describe '#bot_name' do
|
138
|
-
it 'returns nil' do
|
139
|
-
value(client.bot_name).must_be_nil
|
140
|
-
end
|
141
|
-
end
|
142
|
-
end
|
143
|
-
|
144
|
-
describe 'bot' do
|
145
|
-
let(:user_agent) { 'Mozilla/5.0 (compatible; Googlebot/2.1; +http://www.google.com/bot.html)' }
|
146
|
-
|
147
|
-
describe '#name' do
|
148
|
-
it 'returns nil' do
|
149
|
-
value(client.name).must_be_nil
|
150
|
-
end
|
151
|
-
end
|
152
|
-
|
153
|
-
describe '#full_version' do
|
154
|
-
it 'returns nil' do
|
155
|
-
value(client.full_version).must_be_nil
|
156
|
-
end
|
157
|
-
end
|
158
|
-
|
159
|
-
describe '#os_name' do
|
160
|
-
it 'returns nil' do
|
161
|
-
value(client.os_name).must_be_nil
|
162
|
-
end
|
163
|
-
end
|
164
|
-
|
165
|
-
describe '#os_full_version' do
|
166
|
-
it 'returns nil' do
|
167
|
-
value(client.os_full_version).must_be_nil
|
168
|
-
end
|
169
|
-
end
|
170
|
-
|
171
|
-
describe '#known?' do
|
172
|
-
it 'returns false' do
|
173
|
-
value(client.known?).must_equal false
|
174
|
-
end
|
175
|
-
end
|
176
|
-
|
177
|
-
describe '#bot?' do
|
178
|
-
it 'returns true' do
|
179
|
-
value(client.bot?).must_equal true
|
180
|
-
end
|
181
|
-
end
|
182
|
-
|
183
|
-
describe '#bot_name' do
|
184
|
-
it 'returns the name of the bot' do
|
185
|
-
value(client.bot_name).must_equal 'Googlebot'
|
186
|
-
end
|
187
|
-
end
|
188
|
-
end
|
189
|
-
end
|