useragent 0.0.4

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,209 @@
1
+ require 'user_agent'
2
+
3
+ describe "Firefox browser", :shared => true do
4
+ it "should return 'Firefox' as its browser" do
5
+ @useragent.browser.should == "Firefox"
6
+ end
7
+
8
+ it "should return :strong as its security" do
9
+ @useragent.security.should == :strong
10
+ end
11
+ end
12
+
13
+ describe "UserAgent: 'Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.0.1) Gecko/2008070206 Firefox/3.0.1'" do
14
+ before do
15
+ @useragent = UserAgent.parse("Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.0.1) Gecko/2008070206 Firefox/3.0.1")
16
+ end
17
+
18
+ it_should_behave_like "Firefox browser"
19
+
20
+ it "should return '3.0.1' as its version" do
21
+ @useragent.version.should == "3.0.1"
22
+ end
23
+
24
+ it "should return '2008070206' as its gecko version" do
25
+ @useragent.gecko.version.should == "2008070206"
26
+ end
27
+
28
+ it "should return 'X11' as its platform" do
29
+ @useragent.platform.should == "X11"
30
+ end
31
+
32
+ it "should return 'Linux i686' as its os" do
33
+ @useragent.os.should == "Linux i686"
34
+ end
35
+
36
+ it "should return 'en-US' as its localization" do
37
+ @useragent.localization.should == "en-US"
38
+ end
39
+ end
40
+
41
+ describe "UserAgent: 'Mozilla/5.0 (Macintosh; U; Intel Mac OS X; en-US; rv:1.8.1.14) Gecko/20080404 Firefox/2.0.0.14'" do
42
+ before do
43
+ @useragent = UserAgent.parse("Mozilla/5.0 (Macintosh; U; Intel Mac OS X; en-US; rv:1.8.1.14) Gecko/20080404 Firefox/2.0.0.14")
44
+ end
45
+
46
+ it_should_behave_like "Firefox browser"
47
+
48
+ it "should return '2.0.0.14' as its version" do
49
+ @useragent.version.should == "2.0.0.14"
50
+ end
51
+
52
+ it "should return '20080404' as its gecko version" do
53
+ @useragent.gecko.version.should == "20080404"
54
+ end
55
+
56
+ it "should return 'Macintosh' as its platform" do
57
+ @useragent.platform.should == "Macintosh"
58
+ end
59
+
60
+ it "should return 'Intel Mac OS X' as its os" do
61
+ @useragent.os.should == "Intel Mac OS X"
62
+ end
63
+
64
+ it "should return 'en-US' as its localization" do
65
+ @useragent.localization.should == "en-US"
66
+ end
67
+ end
68
+
69
+ describe "UserAgent: 'Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.14) Gecko/20080404 Firefox/2.0.0.14'" do
70
+ before do
71
+ @useragent = UserAgent.parse("Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.14) Gecko/20080404 Firefox/2.0.0.14")
72
+ end
73
+
74
+ it_should_behave_like "Firefox browser"
75
+
76
+ it "should return '2.0.0.14' as its version" do
77
+ @useragent.version.should == "2.0.0.14"
78
+ end
79
+
80
+ it "should return '20080404' as its gecko version" do
81
+ @useragent.gecko.version.should == "20080404"
82
+ end
83
+
84
+ it "should return 'Windows' as its platform" do
85
+ @useragent.platform.should == "Windows"
86
+ end
87
+
88
+ it "should return 'Windows XP' as its os" do
89
+ @useragent.os.should == "Windows XP"
90
+ end
91
+
92
+ it "should return 'en-US' as its localization" do
93
+ @useragent.localization.should == "en-US"
94
+ end
95
+ end
96
+
97
+ describe "UserAgent: 'Mozilla/5.0 (Macintosh; U; PPC Mac OS X Mach-O; en-US; rv:1.8.0.12) Gecko/20070508 Firefox/1.5.0.12'" do
98
+ before do
99
+ @useragent = UserAgent.parse("Mozilla/5.0 (Macintosh; U; PPC Mac OS X Mach-O; en-US; rv:1.8.0.12) Gecko/20070508 Firefox/1.5.0.12")
100
+ end
101
+
102
+ it_should_behave_like "Firefox browser"
103
+
104
+ it "should return '1.5.0.12' as its version" do
105
+ @useragent.version.should == "1.5.0.12"
106
+ end
107
+
108
+ it "should return '20070508' as its gecko version" do
109
+ @useragent.gecko.version.should == "20070508"
110
+ end
111
+
112
+ it "should return 'Macintosh' as its platform" do
113
+ @useragent.platform.should == "Macintosh"
114
+ end
115
+
116
+ it "should return 'PPC Mac OS X Mach-O' as its os" do
117
+ @useragent.os.should == "PPC Mac OS X Mach-O"
118
+ end
119
+
120
+ it "should return 'en-US' as its localization" do
121
+ @useragent.localization.should == "en-US"
122
+ end
123
+ end
124
+
125
+ describe "UserAgent: 'Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.0.12) Gecko/20070508 Firefox/1.5.0.12'" do
126
+ before do
127
+ @useragent = UserAgent.parse("Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.0.12) Gecko/20070508 Firefox/1.5.0.12")
128
+ end
129
+
130
+ it_should_behave_like "Firefox browser"
131
+
132
+ it "should return '1.5.0.12' as its version" do
133
+ @useragent.version.should == "1.5.0.12"
134
+ end
135
+
136
+ it "should return '20070508' as its gecko version" do
137
+ @useragent.gecko.version.should == "20070508"
138
+ end
139
+
140
+ it "should return 'Windows' as its platform" do
141
+ @useragent.platform.should == "Windows"
142
+ end
143
+
144
+ it "should return 'Windows XP' as its os" do
145
+ @useragent.os.should == "Windows XP"
146
+ end
147
+
148
+ it "should return 'en-US' as its localization" do
149
+ @useragent.localization.should == "en-US"
150
+ end
151
+ end
152
+
153
+ describe "UserAgent: 'Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.8.0.4) Gecko/20060612 Firefox/1.5.0.4 Flock/0.7.0.17.1'" do
154
+ before do
155
+ @useragent = UserAgent.parse("Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.8.0.4) Gecko/20060612 Firefox/1.5.0.4 Flock/0.7.0.17.1")
156
+ end
157
+
158
+ it_should_behave_like "Firefox browser"
159
+
160
+ it "should return '1.5.0.4' as its version" do
161
+ @useragent.version.should == "1.5.0.4"
162
+ end
163
+
164
+ it "should return '20060612' as its gecko version" do
165
+ @useragent.gecko.version.should == "20060612"
166
+ end
167
+
168
+ it "should return 'X11' as its platform" do
169
+ @useragent.platform.should == "X11"
170
+ end
171
+
172
+ it "should return 'Linux i686' as its os" do
173
+ @useragent.os.should == "Linux i686"
174
+ end
175
+
176
+ it "should return 'en-US' as its localization" do
177
+ @useragent.localization.should == "en-US"
178
+ end
179
+ end
180
+
181
+ describe "UserAgent: 'Mozilla/5.0 (Macintosh; U; Intel Mac OS X; en; rv:1.8.1.14) Gecko/20080409 Camino/1.6 (like Firefox/2.0.0.14)'" do
182
+ before do
183
+ @useragent = UserAgent.parse("Mozilla/5.0 (Macintosh; U; Intel Mac OS X; en; rv:1.8.1.14) Gecko/20080409 Camino/1.6 (like Firefox/2.0.0.14)")
184
+ end
185
+
186
+ it "should return 'Camino' as its browser" do
187
+ @useragent.browser.should == "Camino"
188
+ end
189
+
190
+ it "should return '1.6' as its version" do
191
+ @useragent.version.should == "1.6"
192
+ end
193
+
194
+ it "should return '20080409' as its gecko version" do
195
+ @useragent.gecko.version.should == "20080409"
196
+ end
197
+
198
+ it "should return 'Macintosh' as its platform" do
199
+ @useragent.platform.should == "Macintosh"
200
+ end
201
+
202
+ it "should return 'Intel Mac OS X' as its os" do
203
+ @useragent.os.should == "Intel Mac OS X"
204
+ end
205
+
206
+ it "should return 'en' as its localization" do
207
+ @useragent.localization.should == "en"
208
+ end
209
+ end
@@ -0,0 +1,99 @@
1
+ require 'user_agent'
2
+
3
+ describe "Internet Explorer browser", :shared => true do
4
+ it "should return 'Internet Explorer' as its browser" do
5
+ @useragent.browser.should == "Internet Explorer"
6
+ end
7
+
8
+ it "should return 'Windows' as its platform" do
9
+ @useragent.platform.should == "Windows"
10
+ end
11
+
12
+ it "should return 'compatible' as its compatibility" do
13
+ @useragent.compatibility.should == "compatible"
14
+ end
15
+
16
+ it "should be compatible" do
17
+ @useragent.should be_compatible
18
+ end
19
+ end
20
+
21
+ describe "UserAgent: 'Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 6.0)'" do
22
+ before do
23
+ @useragent = UserAgent.parse("Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 6.0)")
24
+ end
25
+
26
+ it_should_behave_like "Internet Explorer browser"
27
+
28
+ it "should return '7.0' as its version" do
29
+ @useragent.version.should == "7.0"
30
+ end
31
+
32
+ it "should return 'Windows Vista' as its os" do
33
+ @useragent.os.should == "Windows Vista"
34
+ end
35
+ end
36
+
37
+ describe "UserAgent: 'Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1)'" do
38
+ before do
39
+ @useragent = UserAgent.parse("Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1)")
40
+ end
41
+
42
+ it_should_behave_like "Internet Explorer browser"
43
+
44
+ it "should return '6.0' as its version" do
45
+ @useragent.version.should == "6.0"
46
+ end
47
+
48
+ it "should return 'Windows XP' as its os" do
49
+ @useragent.os.should == "Windows XP"
50
+ end
51
+
52
+ it "should be == 'Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1)'" do
53
+ @useragent.should == @useragent
54
+ end
55
+
56
+ it "should not be == 'Mozilla/4.0 (compatible; MSIE 5.5; Windows NT 5.1)'" do
57
+ @useragent.should_not == UserAgent.parse("Mozilla/4.0 (compatible; MSIE 5.5; Windows NT 5.1)")
58
+ end
59
+
60
+ it "should be > 'Mozilla/4.0 (compatible; MSIE 5.5; Windows NT 5.1)'" do
61
+ @useragent.should > UserAgent.parse("Mozilla/4.0 (compatible; MSIE 5.5; Windows NT 5.1)")
62
+ end
63
+
64
+ it "should not be < 'Mozilla/4.0 (compatible; MSIE 5.5; Windows NT 5.1)'" do
65
+ @useragent.should_not < UserAgent.parse("Mozilla/4.0 (compatible; MSIE 5.5; Windows NT 5.1)")
66
+ end
67
+
68
+ it "should be >= 'Mozilla/4.0 (compatible; MSIE 5.5; Windows NT 5.1)'" do
69
+ @useragent.should >= UserAgent.parse("Mozilla/4.0 (compatible; MSIE 5.5; Windows NT 5.1)")
70
+ end
71
+
72
+ it "should not be >= 'Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 6.0)'" do
73
+ @useragent.should_not >= UserAgent.parse("Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 6.0)")
74
+ end
75
+
76
+ it "should be <= 'Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 6.0)'" do
77
+ @useragent.should <= UserAgent.parse("Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 6.0)")
78
+ end
79
+
80
+ it "should not be <= 'Mozilla/4.0 (compatible; MSIE 5.5; Windows NT 5.1)'" do
81
+ @useragent.should_not <= UserAgent.parse("Mozilla/4.0 (compatible; MSIE 5.5; Windows NT 5.1)")
82
+ end
83
+ end
84
+
85
+ describe "UserAgent: 'Mozilla/4.0 (compatible; MSIE 5.5; Windows NT 5.1)'" do
86
+ before do
87
+ @useragent = UserAgent.parse("Mozilla/4.0 (compatible; MSIE 5.5; Windows NT 5.1)")
88
+ end
89
+
90
+ it_should_behave_like "Internet Explorer browser"
91
+
92
+ it "should return '5.5' as its version" do
93
+ @useragent.version.should == "5.5"
94
+ end
95
+
96
+ it "should return 'Windows XP' as its os" do
97
+ @useragent.os.should == "Windows XP"
98
+ end
99
+ end
@@ -0,0 +1,59 @@
1
+ require 'user_agent'
2
+
3
+ describe "Opera browser", :shared => true do
4
+ it "should return 'Opera' as its browser" do
5
+ @useragent.browser.should == "Opera"
6
+ end
7
+
8
+ it "should return :strong as its security" do
9
+ @useragent.security.should == :strong
10
+ end
11
+ end
12
+
13
+ describe "UserAgent: 'Opera/9.27 (Macintosh; Intel Mac OS X; U; en)'" do
14
+ before do
15
+ @useragent = UserAgent.parse("Opera/9.27 (Macintosh; Intel Mac OS X; U; en)")
16
+ end
17
+
18
+ it_should_behave_like "Opera browser"
19
+
20
+ it "should return '9.27' as its version" do
21
+ @useragent.version.should == "9.27"
22
+ end
23
+
24
+ it "should return 'Macintosh' as its platform" do
25
+ @useragent.platform.should == "Macintosh"
26
+ end
27
+
28
+ it "should return 'Intel Mac OS X' as its os" do
29
+ @useragent.os.should == "Intel Mac OS X"
30
+ end
31
+
32
+ it "should return 'en' as its localization" do
33
+ @useragent.localization.should == "en"
34
+ end
35
+ end
36
+
37
+ describe "UserAgent: 'Opera/9.27 (Windows NT 5.1; U; en)'" do
38
+ before do
39
+ @useragent = UserAgent.parse("Opera/9.27 (Windows NT 5.1; U; en)")
40
+ end
41
+
42
+ it_should_behave_like "Opera browser"
43
+
44
+ it "should return '9.27' as its version" do
45
+ @useragent.version.should == "9.27"
46
+ end
47
+
48
+ it "should return 'Windows' as its platform" do
49
+ @useragent.platform.should == "Windows"
50
+ end
51
+
52
+ it "should return 'Windows XP' as its os" do
53
+ @useragent.os.should == "Windows XP"
54
+ end
55
+
56
+ it "should return 'en' as its localization" do
57
+ @useragent.localization.should == "en"
58
+ end
59
+ end
@@ -0,0 +1,19 @@
1
+ require 'user_agent'
2
+
3
+ describe "UserAgent: 'amaya/9.51 libwww/5.4.0'" do
4
+ before do
5
+ @useragent = UserAgent.parse("amaya/9.51 libwww/5.4.0")
6
+ end
7
+
8
+ it "should return 'amaya' as its browser" do
9
+ @useragent.browser.should == "amaya"
10
+ end
11
+
12
+ it "should return '9.51' as its version" do
13
+ @useragent.version.should == "9.51"
14
+ end
15
+
16
+ it "should return '5.4.0' as its libwww version" do
17
+ @useragent.libwww.version.should == "5.4.0"
18
+ end
19
+ end
@@ -0,0 +1,373 @@
1
+ require 'user_agent'
2
+
3
+ describe "Safari browser", :shared => true do
4
+ it "should return 'Safari' as its browser" do
5
+ @useragent.browser.should == "Safari"
6
+ end
7
+
8
+ it "should return :strong as its security" do
9
+ @useragent.security.should == :strong
10
+ end
11
+ end
12
+
13
+ describe "UserAgent: 'Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10_5_3; en-us) AppleWebKit/526.9 (KHTML, like Gecko) Version/4.0dp1 Safari/526.8'" do
14
+ before do
15
+ @useragent = UserAgent.parse("Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10_5_3; en-us) AppleWebKit/526.9 (KHTML, like Gecko) Version/4.0dp1 Safari/526.8")
16
+ end
17
+
18
+ it_should_behave_like "Safari browser"
19
+
20
+ it "should return '526.8' as its build" do
21
+ @useragent.build.should == "526.8"
22
+ end
23
+
24
+ it "should return '4.0dp1' as its version" do
25
+ @useragent.version.should == "4.0dp1"
26
+ end
27
+
28
+ it "should return '526.9' as its webkit version" do
29
+ @useragent.webkit.version.should == "526.9"
30
+ end
31
+
32
+ it "should return 'Macintosh' as its platform" do
33
+ @useragent.platform.should == "Macintosh"
34
+ end
35
+
36
+ it "should return 'Intel Mac OS X 10_5_3' as its os" do
37
+ @useragent.os.should == "Intel Mac OS X 10_5_3"
38
+ end
39
+
40
+ it "should return 'en-us' as its localization" do
41
+ @useragent.localization.should == "en-us"
42
+ end
43
+ end
44
+
45
+ describe "UserAgent: 'Mozilla/5.0 (Windows; U; Windows NT 5.1; en) AppleWebKit/526.9 (KHTML, like Gecko) Version/4.0dp1 Safari/526.8'" do
46
+ before do
47
+ @useragent = UserAgent.parse("Mozilla/5.0 (Windows; U; Windows NT 5.1; en) AppleWebKit/526.9 (KHTML, like Gecko) Version/4.0dp1 Safari/526.8")
48
+ end
49
+
50
+ it_should_behave_like "Safari browser"
51
+
52
+ it "should return '526.8' as its build" do
53
+ @useragent.build.should == "526.8"
54
+ end
55
+
56
+ it "should return '4.0dp1' as its version" do
57
+ @useragent.version.should == "4.0dp1"
58
+ end
59
+
60
+ it "should return '526.9' as its webkit version" do
61
+ @useragent.webkit.version.should == "526.9"
62
+ end
63
+
64
+ it "should return 'Windows' as its platform" do
65
+ @useragent.platform.should == "Windows"
66
+ end
67
+
68
+ it "should return 'Windows XP' as its os" do
69
+ @useragent.os.should == "Windows XP"
70
+ end
71
+
72
+ it "should return 'en' as its localization" do
73
+ @useragent.localization.should == "en"
74
+ end
75
+ end
76
+
77
+ describe "UserAgent: 'Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10_5_3; en-us) AppleWebKit/525.18 (KHTML, like Gecko) Version/3.1.1 Safari/525.18'" do
78
+ before do
79
+ @useragent = UserAgent.parse("Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10_5_3; en-us) AppleWebKit/525.18 (KHTML, like Gecko) Version/3.1.1 Safari/525.18")
80
+ end
81
+
82
+ it_should_behave_like "Safari browser"
83
+
84
+ it "should return '525.18' as its build" do
85
+ @useragent.build.should == "525.18"
86
+ end
87
+
88
+ it "should return '3.1.1' as its version" do
89
+ @useragent.version.should == "3.1.1"
90
+ end
91
+
92
+ it "should return '525.18' as its webkit version" do
93
+ @useragent.webkit.version.should == "525.18"
94
+ end
95
+
96
+ it "should return 'Macintosh' as its platform" do
97
+ @useragent.platform.should == "Macintosh"
98
+ end
99
+
100
+ it "should return 'Intel Mac OS X 10_5_3' as its os" do
101
+ @useragent.os.should == "Intel Mac OS X 10_5_3"
102
+ end
103
+
104
+ it "should return 'en-us' as its localization" do
105
+ @useragent.localization.should == "en-us"
106
+ end
107
+
108
+ it "should be == 'Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10_5_3; en-us) AppleWebKit/525.18 (KHTML, like Gecko) Version/3.1.1 Safari/525.18'" do
109
+ @useragent.should == @useragent
110
+ end
111
+
112
+ it "should not be == 'Mozilla/5.0 (Macintosh; U; Intel Mac OS X; en) AppleWebKit/419 (KHTML, like Gecko) Safari/419.3'" do
113
+ @useragent.should_not == UserAgent.parse("Mozilla/5.0 (Macintosh; U; Intel Mac OS X; en) AppleWebKit/419 (KHTML, like Gecko) Safari/419.3")
114
+ end
115
+
116
+ it "should be > 'Mozilla/5.0 (Macintosh; U; Intel Mac OS X; en) AppleWebKit/419 (KHTML, like Gecko) Safari/419.3'" do
117
+ @useragent.should > UserAgent.parse("Mozilla/5.0 (Macintosh; U; Intel Mac OS X; en) AppleWebKit/419 (KHTML, like Gecko) Safari/419.3")
118
+ end
119
+
120
+ it "should not be > 'Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10_5_3; en-us) AppleWebKit/526.9 (KHTML, like Gecko) Version/4.0dp1 Safari/526.8'" do
121
+ @useragent.should_not > UserAgent.parse("Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10_5_3; en-us) AppleWebKit/526.9 (KHTML, like Gecko) Version/4.0dp1 Safari/526.8")
122
+ end
123
+
124
+ it "should be < 'Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10_5_3; en-us) AppleWebKit/526.9 (KHTML, like Gecko) Version/4.0dp1 Safari/526.8'" do
125
+ @useragent.should < UserAgent.parse("Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10_5_3; en-us) AppleWebKit/526.9 (KHTML, like Gecko) Version/4.0dp1 Safari/526.8")
126
+ end
127
+
128
+ it "should not be < 'Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10_5_3; en-us) AppleWebKit/525.18 (KHTML, like Gecko) Version/3.1.1 Safari/525.18'" do
129
+ @useragent.should_not < @useragent
130
+ end
131
+
132
+ it "should be >= 'Mozilla/5.0 (Macintosh; U; Intel Mac OS X; en) AppleWebKit/419 (KHTML, like Gecko) Safari/419.3'" do
133
+ @useragent.should >= UserAgent.parse("Mozilla/5.0 (Macintosh; U; Intel Mac OS X; en) AppleWebKit/419 (KHTML, like Gecko) Safari/419.3")
134
+ end
135
+
136
+ it "should not be >= 'Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10_5_3; en-us) AppleWebKit/526.9 (KHTML, like Gecko) Version/4.0dp1 Safari/526.8'" do
137
+ @useragent.should_not >= UserAgent.parse("Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10_5_3; en-us) AppleWebKit/526.9 (KHTML, like Gecko) Version/4.0dp1 Safari/526.8")
138
+ end
139
+
140
+ it "should be <= 'Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10_5_3; en-us) AppleWebKit/525.18 (KHTML, like Gecko) Version/3.1.1 Safari/525.18'" do
141
+ @useragent.should <= @useragent
142
+ end
143
+
144
+ it "should not be <= 'Mozilla/5.0 (Macintosh; U; Intel Mac OS X; en) AppleWebKit/419 (KHTML, like Gecko) Safari/419.3'" do
145
+ @useragent.should_not <= UserAgent.parse("Mozilla/5.0 (Macintosh; U; Intel Mac OS X; en) AppleWebKit/419 (KHTML, like Gecko) Safari/419.3")
146
+ end
147
+ end
148
+
149
+ describe "UserAgent: 'Mozilla/5.0 (Windows; U; Windows NT 5.1; en) AppleWebKit/525.18 (KHTML, like Gecko) Version/3.1.1 Safari/525.18'" do
150
+ before do
151
+ @useragent = UserAgent.parse("Mozilla/5.0 (Windows; U; Windows NT 5.1; en) AppleWebKit/525.18 (KHTML, like Gecko) Version/3.1.1 Safari/525.18")
152
+ end
153
+
154
+ it_should_behave_like "Safari browser"
155
+
156
+ it "should return '525.18' as its build" do
157
+ @useragent.build.should == "525.18"
158
+ end
159
+
160
+ it "should return '3.1.1' as its version" do
161
+ @useragent.version.should == "3.1.1"
162
+ end
163
+
164
+ it "should return '525.18' as its webkit version" do
165
+ @useragent.webkit.version.should == "525.18"
166
+ end
167
+
168
+ it "should return 'Windows' as its platform" do
169
+ @useragent.platform.should == "Windows"
170
+ end
171
+
172
+ it "should return 'Windows XP' as its os" do
173
+ @useragent.os.should == "Windows XP"
174
+ end
175
+
176
+ it "should return 'en' as its localization" do
177
+ @useragent.localization.should == "en"
178
+ end
179
+ end
180
+
181
+ describe "UserAgent: 'Mozilla/5.0 (Macintosh; U; Intel Mac OS X; en) AppleWebKit/419 (KHTML, like Gecko) Safari/419.3'" do
182
+ before do
183
+ @useragent = UserAgent.parse("Mozilla/5.0 (Macintosh; U; Intel Mac OS X; en) AppleWebKit/419 (KHTML, like Gecko) Safari/419.3")
184
+ end
185
+
186
+ it_should_behave_like "Safari browser"
187
+
188
+ it "should return '419.3' as its build" do
189
+ @useragent.build.should == "419.3"
190
+ end
191
+
192
+ it "should return '2.0.4' as its version" do
193
+ @useragent.version.should == "2.0.4"
194
+ end
195
+
196
+ it "should return '419' as its webkit version" do
197
+ @useragent.webkit.version.should == "419"
198
+ end
199
+
200
+ it "should return 'Macintosh' as its platform" do
201
+ @useragent.platform.should == "Macintosh"
202
+ end
203
+
204
+ it "should return 'Intel Mac OS X' as its os" do
205
+ @useragent.os.should == "Intel Mac OS X"
206
+ end
207
+
208
+ it "should return 'en' as its localization" do
209
+ @useragent.localization.should == "en"
210
+ end
211
+ end
212
+
213
+ describe "UserAgent: 'Mozilla/5.0 (Macintosh; U; PPC Mac OS X; en) AppleWebKit/312.8 (KHTML, like Gecko) Safari/312.6'" do
214
+ before do
215
+ @useragent = UserAgent.parse("Mozilla/5.0 (Macintosh; U; PPC Mac OS X; en) AppleWebKit/312.8 (KHTML, like Gecko) Safari/312.6")
216
+ end
217
+
218
+ it_should_behave_like "Safari browser"
219
+
220
+ it "should return '312.6' as its build" do
221
+ @useragent.build.should == "312.6"
222
+ end
223
+
224
+ it "should return '1.3.2' as its version" do
225
+ @useragent.version.should == "1.3.2"
226
+ end
227
+
228
+ it "should return '312.8' as its webkit version" do
229
+ @useragent.webkit.version.should == "312.8"
230
+ end
231
+
232
+ it "should return 'Macintosh' as its platform" do
233
+ @useragent.platform.should == "Macintosh"
234
+ end
235
+
236
+ it "should return 'PPC Mac OS X' as its os" do
237
+ @useragent.os.should == "PPC Mac OS X"
238
+ end
239
+
240
+ it "should return 'en' as its localization" do
241
+ @useragent.localization.should == "en"
242
+ end
243
+ end
244
+
245
+ describe "UserAgent: 'Mozilla/5.0 (Macintosh; U; PPC Mac OS X; en) AppleWebKit/125.5.7 (KHTML, like Gecko) Safari/125.12'" do
246
+ before do
247
+ @useragent = UserAgent.parse("Mozilla/5.0 (Macintosh; U; PPC Mac OS X; en) AppleWebKit/125.5.7 (KHTML, like Gecko) Safari/125.12")
248
+ end
249
+
250
+ it_should_behave_like "Safari browser"
251
+
252
+ it "should return '125.12' as its build" do
253
+ @useragent.build.should == "125.12"
254
+ end
255
+
256
+ it "should return '1.2.4' as its version" do
257
+ @useragent.version.should == "1.2.4"
258
+ end
259
+
260
+ it "should return '125.5.7' as its webkit version" do
261
+ @useragent.webkit.version.should == "125.5.7"
262
+ end
263
+
264
+ it "should return 'Macintosh' as its platform" do
265
+ @useragent.platform.should == "Macintosh"
266
+ end
267
+
268
+ it "should return 'PPC Mac OS X' as its os" do
269
+ @useragent.os.should == "PPC Mac OS X"
270
+ end
271
+
272
+ it "should return 'en' as its localization" do
273
+ @useragent.localization.should == "en"
274
+ end
275
+ end
276
+
277
+ describe "UserAgent: 'Mozilla/5.0 (iPhone; U; CPU like Mac OS X; en) AppleWebKit/420.1 (KHTML, like Gecko) Version/3.0 Mobile/4A102 Safari/419'" do
278
+ before do
279
+ @useragent = UserAgent.parse("Mozilla/5.0 (iPhone; U; CPU like Mac OS X; en) AppleWebKit/420.1 (KHTML, like Gecko) Version/3.0 Mobile/4A102 Safari/419")
280
+ end
281
+
282
+ it_should_behave_like "Safari browser"
283
+
284
+ it "should return '419' as its build" do
285
+ @useragent.build.should == "419"
286
+ end
287
+
288
+ it "should return '3.0' as its version" do
289
+ @useragent.version.should == "3.0"
290
+ end
291
+
292
+ it "should return '420.1' as its webkit version" do
293
+ @useragent.webkit.version.should == "420.1"
294
+ end
295
+
296
+ it "should return 'iPhone' as its platform" do
297
+ @useragent.platform.should == "iPhone"
298
+ end
299
+
300
+ it "should return 'CPU like Mac OS X' as its os" do
301
+ @useragent.os.should == "CPU like Mac OS X"
302
+ end
303
+
304
+ it "should return 'en' as its localization" do
305
+ @useragent.localization.should == "en"
306
+ end
307
+ end
308
+
309
+ describe "UserAgent: 'Mozilla/5.0 (iPod; U; CPU like Mac OS X; en) AppleWebKit/420.1 (KHTML, like Gecko) Version/3.0 Mobile/4A102 Safari/419'" do
310
+ before do
311
+ @useragent = UserAgent.parse("Mozilla/5.0 (iPod; U; CPU like Mac OS X; en) AppleWebKit/420.1 (KHTML, like Gecko) Version/3.0 Mobile/4A102 Safari/419")
312
+ end
313
+
314
+ it_should_behave_like "Safari browser"
315
+
316
+ it "should return '419' as its build" do
317
+ @useragent.build.should == "419"
318
+ end
319
+
320
+ it "should return '3.0' as its version" do
321
+ @useragent.version.should == "3.0"
322
+ end
323
+
324
+ it "should return '420.1' as its webkit version" do
325
+ @useragent.webkit.version.should == "420.1"
326
+ end
327
+
328
+ it "should return 'iPod' as its platform" do
329
+ @useragent.platform.should == "iPod"
330
+ end
331
+
332
+ it "should return 'CPU like Mac OS X' as its os" do
333
+ @useragent.os.should == "CPU like Mac OS X"
334
+ end
335
+
336
+ it "should return 'en' as its localization" do
337
+ @useragent.localization.should == "en"
338
+ end
339
+ end
340
+
341
+ describe "UserAgent: 'Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US) AppleWebKit/525.13 (KHTML, like Gecko) Chrome/0.0.2 Safari/525.13'" do
342
+ before do
343
+ @useragent = UserAgent.parse("Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US) AppleWebKit/525.13 (KHTML, like Gecko) Chrome/0.0.2 Safari/525.13")
344
+ end
345
+
346
+ it "should return 'Chrome' as its browser" do
347
+ @useragent.browser.should == "Chrome"
348
+ end
349
+
350
+ it "should return '525.13' as its build" do
351
+ @useragent.build.should == "525.13"
352
+ end
353
+
354
+ it "should return '0.0.2' as its version" do
355
+ @useragent.version.should == "0.0.2"
356
+ end
357
+
358
+ it "should return '525.13' as its webkit version" do
359
+ @useragent.webkit.version.should == "525.13"
360
+ end
361
+
362
+ it "should return 'Windows' as its platform" do
363
+ @useragent.platform.should == "Windows"
364
+ end
365
+
366
+ it "should return 'Windows XP' as its os" do
367
+ @useragent.os.should == "Windows XP"
368
+ end
369
+
370
+ it "should return 'en-US' as its localization" do
371
+ @useragent.localization.should == "en-US"
372
+ end
373
+ end