device_detector 0.4.0 → 0.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -59,6 +59,85 @@ describe DeviceDetector::Device do
59
59
 
60
60
  end
61
61
 
62
+ context 'device not specified in nested block' do
63
+
64
+ let(:user_agent) { 'Mozilla/5.0 (Linux; Android 4.4.2; es-us; SAMSUNG SM-G900F Build/KOT49H) AppleWebKit/537.36 (KHTML, like Gecko)' }
65
+
66
+ it 'falls back to top-level device' do
67
+ expect(device.type).to eq('smartphone')
68
+ end
69
+
70
+ end
71
+
72
+ end
73
+
74
+ context 'concrete device types' do
75
+
76
+ describe 'mobiles' do
77
+
78
+ let(:user_agent) { 'Mozilla/5.0 (Linux; Android 4.4.2; es-us; SAMSUNG SM-G900F Build/KOT49H) AppleWebKit/537.36 (KHTML, like Gecko)' }
79
+
80
+ it 'identifies the device' do
81
+ expect(device.name).to eq('GALAXY S5')
82
+ expect(device.type).to eq('smartphone')
83
+ end
84
+
85
+ end
86
+
87
+ describe 'cameras' do
88
+
89
+ let(:user_agent) { 'Mozilla/5.0 (Linux; U; Android 4.0; xx-xx; EK-GC100 Build/IMM76D) AppleWebKit/534.30 (KHTML, like Gecko) Version/4.0 Mobile Safari/534.30' }
90
+
91
+ it 'identifies the device' do
92
+ expect(device.name).to eq('GALAXY Camera')
93
+ expect(device.type).to eq('camera')
94
+ end
95
+
96
+ end
97
+
98
+ describe 'car browsers' do
99
+
100
+ let(:user_agent) { 'Mozilla/5.0 (X11; Linux) AppleWebKit/534.34 (KHTML, like Gecko) QtCarBrowser Safari/534.34' }
101
+
102
+ it 'identifies the device' do
103
+ expect(device.name).to eq('Model S')
104
+ expect(device.type).to eq('car browser')
105
+ end
106
+
107
+ end
108
+
109
+ describe '(gaming) consoles' do
110
+
111
+ let(:user_agent) { 'Opera/9.30 (Nintendo Wii; U; ; 2047-7;en)' }
112
+
113
+ it 'identifies the device' do
114
+ expect(device.name).to eq('Wii')
115
+ expect(device.type).to eq('console')
116
+ end
117
+
118
+ end
119
+
120
+ describe 'portable media players' do
121
+
122
+ let(:user_agent) { 'Mozilla/5.0 (iPod touch; CPU iPhone OS 7_0_6 like Mac OS X) AppleWebKit/537.51.1 (KHTML, like Gecko) Version/7.0 Mobile/11B651 Safari/9537.53' }
123
+
124
+ it 'identifies the device' do
125
+ expect(device.name).to eq('iPod Touch')
126
+ expect(device.type).to eq('portable media player')
127
+ end
128
+
129
+ end
130
+
131
+ describe 'televisions' do
132
+
133
+ let(:user_agent) { 'Mozilla/5.0 (Linux; NetCast; U) AppleWebKit/537.31 (KHTML, like Gecko) Chrome/26.0.1410.33 Safari/537.31 SmartTV/5.0' }
134
+
135
+ it 'identifies the device' do
136
+ expect(device.name).to eq('NetCast')
137
+ expect(device.type).to eq('tv')
138
+ end
139
+
140
+ end
62
141
  end
63
142
 
64
143
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: device_detector
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.0
4
+ version: 0.5.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Mati Sójka
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2015-02-23 00:00:00.000000000 Z
12
+ date: 2015-03-17 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rspec
@@ -45,8 +45,8 @@ dependencies:
45
45
  - - "~>"
46
46
  - !ruby/object:Gem::Version
47
47
  version: '0.10'
48
- description: The Universal Device Detection library will parse any User Agent and
49
- detect the browser, operating system, device, brand and model.
48
+ description: Precise and fast user agent parser and device detector, backed by the
49
+ largest and most up-to-date agent and device database
50
50
  email:
51
51
  - yagooar@gmail.com
52
52
  executables: []
@@ -54,6 +54,7 @@ extensions: []
54
54
  extra_rdoc_files: []
55
55
  files:
56
56
  - ".gitignore"
57
+ - ".travis.yml"
57
58
  - Gemfile
58
59
  - LICENSE.txt
59
60
  - README.md
@@ -73,7 +74,12 @@ files:
73
74
  - regexes/bots.yml
74
75
  - regexes/browser_engines.yml
75
76
  - regexes/browsers.yml
77
+ - regexes/devices/cameras.yml
78
+ - regexes/devices/car_browsers.yml
79
+ - regexes/devices/consoles.yml
76
80
  - regexes/devices/mobiles.yml
81
+ - regexes/devices/portable_media_players.yml
82
+ - regexes/devices/televisions.yml
77
83
  - regexes/feed_readers.yml
78
84
  - regexes/libraries.yml
79
85
  - regexes/mediaplayers.yml
@@ -109,7 +115,7 @@ rubyforge_project:
109
115
  rubygems_version: 2.4.5
110
116
  signing_key:
111
117
  specification_version: 4
112
- summary: Universal Device Detection
118
+ summary: Precise and fast user agent parser and device detector
113
119
  test_files:
114
120
  - spec/device_detector/device_spec.rb
115
121
  - spec/device_detector/memory_cache_spec.rb