guilded 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (44) hide show
  1. data/.gitignore +3 -0
  2. data/History.txt +111 -0
  3. data/README.rdoc +219 -0
  4. data/Rakefile +56 -0
  5. data/VERSION +1 -0
  6. data/guilded.gemspec +90 -0
  7. data/lib/guilded.rb +79 -0
  8. data/lib/guilded/browser_detector.rb +217 -0
  9. data/lib/guilded/component_def.rb +24 -0
  10. data/lib/guilded/exceptions.rb +29 -0
  11. data/lib/guilded/guilder.rb +357 -0
  12. data/lib/guilded/rails.rb +4 -0
  13. data/lib/guilded/rails/active_record/human_attribute_hint.rb +41 -0
  14. data/lib/guilded/rails/active_record/human_attribute_override.rb +41 -0
  15. data/lib/guilded/rails/helpers.rb +123 -0
  16. data/lib/guilded/rails/inactive_record/human_attribute_hint.rb +26 -0
  17. data/lib/guilded/rails/view_helpers.rb +147 -0
  18. data/rails_generators/guilded_assets/guilded_assets_generator.rb +23 -0
  19. data/rails_generators/guilded_assets/templates/guilded.js +12 -0
  20. data/rails_generators/guilded_assets/templates/guilded.min.js +1 -0
  21. data/rails_generators/guilded_assets/templates/jquery-1.2.6.js +3549 -0
  22. data/rails_generators/guilded_assets/templates/jquery-1.2.6.min.js +32 -0
  23. data/rails_generators/guilded_assets/templates/jquery-1.3.2.js +4376 -0
  24. data/rails_generators/guilded_assets/templates/jquery-1.3.2.min.js +19 -0
  25. data/rails_generators/guilded_assets/templates/jquery-url.js +199 -0
  26. data/rails_generators/guilded_assets/templates/jquery-url.min.js +9 -0
  27. data/rails_generators/guilded_assets/templates/mootools-1.2.3.js +4036 -0
  28. data/rails_generators/guilded_assets/templates/mootools-1.2.3.min.js +356 -0
  29. data/rails_generators/guilded_assets/templates/reset-min.css +7 -0
  30. data/rails_generators/guilded_config/guilded_config_generator.rb +11 -0
  31. data/rails_generators/guilded_config/templates/load_guilded_settings.rb +13 -0
  32. data/script/console +10 -0
  33. data/script/destroy +14 -0
  34. data/script/generate +14 -0
  35. data/tasks/rails.rake +8 -0
  36. data/tasks/rspec.rake +21 -0
  37. data/test/guilded/browser_detector_test.rb +1248 -0
  38. data/test/guilded/component_def_test.rb +26 -0
  39. data/test/guilded/guilder_test.rb +79 -0
  40. data/test/guilded/rails/helpers_test.rb +1450 -0
  41. data/test/guilded/rails/view_helpers_test.rb +97 -0
  42. data/test/guilded_test.rb +7 -0
  43. data/test/test_helper.rb +47 -0
  44. metadata +112 -0
@@ -0,0 +1,1248 @@
1
+ require 'test_helper'
2
+
3
+ class BrowserDetectorTest < Test::Unit::TestCase
4
+ context "The browser detector" do
5
+ setup do
6
+ @user_agents = {
7
+ :ie55 => 'Mozilla/4.0 (compatible; MSIE 5.5; Windows NT 5.1)',
8
+ :ie60 => 'Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1)',
9
+ :ie70 => 'Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1)',
10
+ :ie80 => 'Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 5.1; Trident/4.0)',
11
+ :firefox2 => 'Mozilla/5.0 (Macintosh; U; Intel Mac OS X; en-US; rv:1.8.1.17) Gecko/20080829 Firefox/2.0.0.17',
12
+ :firefox3 => 'Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.6; en-US; rv:1.9.0.11) Gecko/2009060214 Firefox/3.0.11',
13
+ :firefox35 => 'Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.6; en-US; rv:1.9.1.3) Gecko/20090824 Firefox/3.5.3',
14
+ :firefox35win => 'Mozilla/5.0 (Windows; U; Windows NT 6.0; en-US; rv:1.9.1.3) Gecko/20090824 Firefox/3.5.3 (.NET CLR 3.5.30729)',
15
+ :opera10 => 'Opera/9.80 (Macintosh; Intel Mac OS X; U; en) Presto/2.2.15 Version/10.00'
16
+ }
17
+ end
18
+
19
+ should "know all of its known browser ids" do
20
+ assert_equal Guilded::BrowserDetector.all_browsers.sort.join( ' ' ), "chrome firefox ie55 ie60 ie70 ie80 konqueror netscape opera safari"
21
+ end
22
+
23
+ should "know all of its known mobile browser ids" do
24
+ assert_equal Guilded::BrowserDetector.all_mobile_browsers.sort.join( ' ' ), "ie_ce4 iphone"
25
+ end
26
+
27
+ should "have correct sample user agents for known browsers" do
28
+ @user_agents.each { |key, value| assert_equal value, Guilded::BrowserDetector.user_agents[key] }
29
+ end
30
+
31
+ context "when given Firefox 2.0 user agent" do
32
+ setup do
33
+ @detector = Guilded::BrowserDetector.new( @user_agents[:firefox2] )
34
+ assert !@detector.ua.nil?
35
+ end
36
+
37
+ should "agree that the browser name is 'firefox'" do
38
+ assert_equal @detector.browser_name, 'firefox'
39
+ end
40
+
41
+ should "agree that the browser version is '2.0.0.17'" do
42
+ assert_equal @detector.browser_version, '2.0.0.17'
43
+ end
44
+
45
+ should "agree that the browser major version is '2'" do
46
+ assert_equal @detector.browser_version_major, '2'
47
+ end
48
+
49
+ should "agree that the browser minor version is '0'" do
50
+ assert_equal @detector.browser_version_minor, '0'
51
+ end
52
+
53
+ should "agree that the browser build version is '0'" do
54
+ assert_equal @detector.browser_version_build, '0'
55
+ end
56
+
57
+ should "agree that the browser revision version is '17'" do
58
+ assert_equal @detector.browser_version_revision, '17'
59
+ end
60
+
61
+ should "have a browser id of 'firefox20017'" do
62
+ assert_equal @detector.browser_id, 'firefox20017'
63
+ end
64
+
65
+ should "have a browser full name of 'Firefox 2.0.0.17'" do
66
+ assert_equal @detector.browser_full_name, 'Firefox 2.0.0.17'
67
+ end
68
+
69
+ should "be able to use a png" do
70
+ assert @detector.can_use_png?
71
+ end
72
+
73
+ should "agree that the browser is :browser => 'firefox'" do
74
+ assert @detector.browser_is?( :name => 'firefox' )
75
+ end
76
+
77
+ should "agree that the browser is :browser => :firefox" do
78
+ assert @detector.browser_is?( :name => :firefox )
79
+ end
80
+
81
+ should "agree that the browser is :version => '2.0.0.17'" do
82
+ assert @detector.browser_is?( :version => '2.0.0.17' )
83
+ end
84
+
85
+ should "agree that the browser is :name => 'firefox' and :version => '2.0.0.17'" do
86
+ assert @detector.browser_is?( :name => 'firefox', :version => '2.0.0.17' )
87
+ end
88
+
89
+ should "agree that the browser is :name => :firefox and :version => '2.0.0.17'" do
90
+ assert @detector.browser_is?( :name => :firefox, :version => '2.0.0.17' )
91
+ end
92
+
93
+ should "agree that the browser is :major_version => '2'" do
94
+ assert @detector.browser_is?( :major_version => '2' )
95
+ end
96
+
97
+ should "agree that the browser is :minor_version => '0'" do
98
+ assert @detector.browser_is?( :minor_version => '0' )
99
+ end
100
+
101
+ should "agree that the browser is :build_version => '0'" do
102
+ assert @detector.browser_is?( :build_version => '0' )
103
+ end
104
+
105
+ should "agree that the browser is :revision_version => '17'" do
106
+ assert @detector.browser_is?( :revision_version => '17' )
107
+ end
108
+
109
+ should "agree that the browser is :major_version => '2', :minor_version => '0'" do
110
+ assert @detector.browser_is?( :major_version => '2', :minor_version => '0' )
111
+ end
112
+
113
+ should "agree that the browser is :major_version => '2', :minor_version => '0', :build_version => '0'" do
114
+ assert @detector.browser_is?( :major_version => '2', :minor_version => '0', :build_version => '0' )
115
+ end
116
+
117
+ should "agree that the browser is :major_version => '2', :minor_version => '0', :build_version => '0', :revision_version => '17'" do
118
+ assert @detector.browser_is?( :major_version => '2', :minor_version => '0', :build_version => '0', :revision_version => '17' )
119
+ end
120
+
121
+ should "agree that the browser is :name => 'firefox', :major_version => '2'" do
122
+ assert @detector.browser_is?( :name => 'firefox', :major_version => '2' )
123
+ end
124
+
125
+ should "agree that the browser is :name => 'firefox', :minor_version => '0'" do
126
+ assert @detector.browser_is?( :name => 'firefox', :minor_version => '0' )
127
+ end
128
+
129
+ should "agree that the browser is :name => 'firefox', :build_version => '0'" do
130
+ assert @detector.browser_is?( :name => 'firefox', :build_version => '0' )
131
+ end
132
+
133
+ should "agree that the browser is :name => 'firefox', :revision_version => '17'" do
134
+ assert @detector.browser_is?( :name => 'firefox', :revision_version => '17' )
135
+ end
136
+
137
+ should "agree that the browser is :name => 'firefox', :major_version => 2" do
138
+ assert @detector.browser_is?( :name => 'firefox', :major_version => 2 )
139
+ end
140
+
141
+ should "agree that the browser is :name => 'firefox', :minor_version => 0" do
142
+ assert @detector.browser_is?( :name => 'firefox', :minor_version => 0 )
143
+ end
144
+
145
+ should "agree that the browser is :name => 'firefox', :build_version => 0" do
146
+ assert @detector.browser_is?( :name => 'firefox', :build_version => 0 )
147
+ end
148
+
149
+ should "agree that the browser is :name => 'firefox', :revision_version => 17" do
150
+ assert @detector.browser_is?( :name => 'firefox', :revision_version => 17 )
151
+ end
152
+
153
+ should "agree that the browser is :name => 'firefox', :major_version => '2', :minor_version => '0'" do
154
+ assert @detector.browser_is?( :name => 'firefox', :major_version => '2', :minor_version => '0' )
155
+ end
156
+
157
+ should "agree that the browser is :name => 'firefox', :major_version => '2', :minor_version => '0', :build_version => '0'" do
158
+ assert @detector.browser_is?( :name => 'firefox', :major_version => '2', :minor_version => '0', :build_version => '0' )
159
+ end
160
+
161
+ should "agree that the browser is :name => 'firefox', :major_version => '2', :minor_version => '0', :build_version => '0', :revision_version => '17'" do
162
+ assert @detector.browser_is?( :name => 'firefox', :major_version => '2', :minor_version => '0', :build_version => '0', :revision_version => '17' )
163
+ end
164
+ end
165
+
166
+ context "when given Firefox 3.0 user agent" do
167
+ setup do
168
+ @detector = Guilded::BrowserDetector.new( @user_agents[:firefox3] )
169
+ assert !@detector.ua.nil?
170
+ end
171
+
172
+ should "agree that the browser name is 'firefox'" do
173
+ assert_equal @detector.browser_name, 'firefox'
174
+ end
175
+
176
+ should "agree that the browser version is '3.0.11'" do
177
+ assert_equal @detector.browser_version, '3.0.11'
178
+ end
179
+
180
+ should "agree that the browser major version is '3'" do
181
+ assert_equal @detector.browser_version_major, '3'
182
+ end
183
+
184
+ should "agree that the browser minor version is '0'" do
185
+ assert_equal @detector.browser_version_minor, '0'
186
+ end
187
+
188
+ should "agree that the browser build version is '11'" do
189
+ assert_equal @detector.browser_version_build, '11'
190
+ end
191
+
192
+ should "agree that the browser revision version is '0'" do
193
+ assert_equal @detector.browser_version_revision, '0'
194
+ end
195
+
196
+ should "have a browser id of 'firefox3011'" do
197
+ assert_equal @detector.browser_id, 'firefox3011'
198
+ end
199
+
200
+ should "have a browser full name of 'Firefox 3.0.11'" do
201
+ assert_equal @detector.browser_full_name, 'Firefox 3.0.11'
202
+ end
203
+
204
+ should "be able to use a png" do
205
+ assert @detector.can_use_png?
206
+ end
207
+
208
+ should "agree that the browser is :browser => 'firefox'" do
209
+ assert @detector.browser_is?( :name => 'firefox' )
210
+ end
211
+
212
+ should "agree that the browser is :browser => :firefox" do
213
+ assert @detector.browser_is?( :name => :firefox )
214
+ end
215
+
216
+ should "agree that the browser is :version => '3.0.11'" do
217
+ assert @detector.browser_is?( :version => '3.0.11' )
218
+ end
219
+
220
+ should "agree that the browser is :name => 'firefox' and :version => '3.0.11'" do
221
+ assert @detector.browser_is?( :name => 'firefox', :version => '3.0.11' )
222
+ end
223
+
224
+ should "agree that the browser is :name => :firefox and :version => '3.0.11'" do
225
+ assert @detector.browser_is?( :name => :firefox, :version => '3.0.11' )
226
+ end
227
+
228
+ should "agree that the browser is :major_version => '3'" do
229
+ assert @detector.browser_is?( :major_version => '3' )
230
+ end
231
+
232
+ should "agree that the browser is :minor_version => '0'" do
233
+ assert @detector.browser_is?( :minor_version => '0' )
234
+ end
235
+
236
+ should "agree that the browser is :build_version => '11'" do
237
+ assert @detector.browser_is?( :build_version => '11' )
238
+ end
239
+
240
+ should "agree that the browser is :revision_version => '0'" do
241
+ assert @detector.browser_is?( :revision_version => '0' )
242
+ end
243
+
244
+ should "agree that the browser is :major_version => 3" do
245
+ assert @detector.browser_is?( :major_version => 3 )
246
+ end
247
+
248
+ should "agree that the browser is :minor_version => 0" do
249
+ assert @detector.browser_is?( :minor_version => 0 )
250
+ end
251
+
252
+ should "agree that the browser is :build_version => 11" do
253
+ assert @detector.browser_is?( :build_version => 11 )
254
+ end
255
+
256
+ should "agree that the browser is :revision_version => 0" do
257
+ assert @detector.browser_is?( :revision_version => 0 )
258
+ end
259
+
260
+ should "agree that the browser is :major_version => '3', :minor_version => '0'" do
261
+ assert @detector.browser_is?( :major_version => '3', :minor_version => '0' )
262
+ end
263
+
264
+ should "agree that the browser is :major_version => '3', :minor_version => '0', :build_version => '11'" do
265
+ assert @detector.browser_is?( :major_version => '3', :minor_version => '0', :build_version => '11' )
266
+ end
267
+
268
+ should "agree that the browser is :major_version => '3', :minor_version => '0', :build_version => '11', :revision_version => '0'" do
269
+ assert @detector.browser_is?( :major_version => '3', :minor_version => '0', :build_version => '11', :revision_version => '0' )
270
+ end
271
+
272
+ should "agree that the browser is :name => 'firefox', :major_version => '3'" do
273
+ assert @detector.browser_is?( :name => 'firefox', :major_version => '3' )
274
+ end
275
+
276
+ should "agree that the browser is :name => 'firefox', :minor_version => '0'" do
277
+ assert @detector.browser_is?( :name => 'firefox', :minor_version => '0' )
278
+ end
279
+
280
+ should "agree that the browser is :name => 'firefox', :build_version => '11'" do
281
+ assert @detector.browser_is?( :name => 'firefox', :build_version => '11' )
282
+ end
283
+
284
+ should "agree that the browser is :name => 'firefox', :revision_version => '0'" do
285
+ assert @detector.browser_is?( :name => 'firefox', :revision_version => '0' )
286
+ end
287
+
288
+ should "agree that the browser is :name => 'firefox', :major_version => '3', :minor_version => '0'" do
289
+ assert @detector.browser_is?( :name => 'firefox', :major_version => '3', :minor_version => '0' )
290
+ end
291
+
292
+ should "agree that the browser is :name => 'firefox', :major_version => '3', :minor_version => '0', :build_version => '11'" do
293
+ assert @detector.browser_is?( :name => 'firefox', :major_version => '3', :minor_version => '0', :build_version => '11' )
294
+ end
295
+
296
+ should "agree that the browser is :name => 'firefox', :major_version => '3', :minor_version => '0', :build_version => '11', :revision_version => '0'" do
297
+ assert @detector.browser_is?( :name => 'firefox', :major_version => '3', :minor_version => '0', :build_version => '11', :revision_version => '0' )
298
+ end
299
+ end
300
+
301
+ context "when given Firefox 3.5 user agent" do
302
+ setup do
303
+ @detector = Guilded::BrowserDetector.new( @user_agents[:firefox35] )
304
+ assert !@detector.ua.nil?
305
+ end
306
+
307
+ should "agree that the browser name is 'firefox'" do
308
+ assert_equal @detector.browser_name, 'firefox'
309
+ end
310
+
311
+ should "agree that the browser version is '3.5.3'" do
312
+ assert_equal @detector.browser_version, '3.5.3'
313
+ end
314
+
315
+ should "agree that the browser major version is '3'" do
316
+ assert_equal @detector.browser_version_major, '3'
317
+ end
318
+
319
+ should "agree that the browser minor version is '5'" do
320
+ assert_equal @detector.browser_version_minor, '5'
321
+ end
322
+
323
+ should "agree that the browser build version is '3'" do
324
+ assert_equal @detector.browser_version_build, '3'
325
+ end
326
+
327
+ should "agree that the browser revision version is '0'" do
328
+ assert_equal @detector.browser_version_revision, '0'
329
+ end
330
+
331
+ should "have a browser id of 'firefox353'" do
332
+ assert_equal @detector.browser_id, 'firefox353'
333
+ end
334
+
335
+ should "have a browser full name of 'Firefox 3.5.3'" do
336
+ assert_equal @detector.browser_full_name, 'Firefox 3.5.3'
337
+ end
338
+
339
+ should "be able to use a png" do
340
+ assert @detector.can_use_png?
341
+ end
342
+
343
+ should "agree that the browser is :browser => 'firefox'" do
344
+ assert @detector.browser_is?( :name => 'firefox' )
345
+ end
346
+
347
+ should "agree that the browser is :browser => :firefox" do
348
+ assert @detector.browser_is?( :name => :firefox )
349
+ end
350
+
351
+ should "agree that the browser is :version => '3.5.3'" do
352
+ assert @detector.browser_is?( :version => '3.5.3' )
353
+ end
354
+
355
+ should "agree that the browser is :name => 'firefox' and :version => '3.5.3'" do
356
+ assert @detector.browser_is?( :name => 'firefox', :version => '3.5.3' )
357
+ end
358
+
359
+ should "agree that the browser is :name => :firefox and :version => '3.5.3'" do
360
+ assert @detector.browser_is?( :name => :firefox, :version => '3.5.3' )
361
+ end
362
+
363
+ should "agree that the browser is :major_version => '3'" do
364
+ assert @detector.browser_is?( :major_version => '3' )
365
+ end
366
+
367
+ should "agree that the browser is :minor_version => 5'" do
368
+ assert @detector.browser_is?( :minor_version => '5' )
369
+ end
370
+
371
+ should "agree that the browser is :build_version => '3'" do
372
+ assert @detector.browser_is?( :build_version => '3' )
373
+ end
374
+
375
+ should "agree that the browser is :revision_version => '0'" do
376
+ assert @detector.browser_is?( :revision_version => '0' )
377
+ end
378
+
379
+ should "agree that the browser is :major_version => 3" do
380
+ assert @detector.browser_is?( :major_version => 3 )
381
+ end
382
+
383
+ should "agree that the browser is :minor_version => 5" do
384
+ assert @detector.browser_is?( :minor_version => 5 )
385
+ end
386
+
387
+ should "agree that the browser is :build_version => 3" do
388
+ assert @detector.browser_is?( :build_version => 3 )
389
+ end
390
+
391
+ should "agree that the browser is :revision_version => 0" do
392
+ assert @detector.browser_is?( :revision_version => 0 )
393
+ end
394
+
395
+ should "agree that the browser is :major_version => '3', :minor_version => '5'" do
396
+ assert @detector.browser_is?( :major_version => '3', :minor_version => '5' )
397
+ end
398
+
399
+ should "agree that the browser is :major_version => '3', :minor_version => '5', :build_version => '3'" do
400
+ assert @detector.browser_is?( :major_version => '3', :minor_version => '5', :build_version => '3' )
401
+ end
402
+
403
+ should "agree that the browser is :major_version => '3', :minor_version => '5', :build_version => '3', :revision_version => '0'" do
404
+ assert @detector.browser_is?( :major_version => '3', :minor_version => '5', :build_version => '3', :revision_version => '0' )
405
+ end
406
+
407
+ should "agree that the browser is :name => 'firefox', :major_version => '3'" do
408
+ assert @detector.browser_is?( :name => 'firefox', :major_version => '3' )
409
+ end
410
+
411
+ should "agree that the browser is :name => 'firefox', :minor_version => '5'" do
412
+ assert @detector.browser_is?( :name => 'firefox', :minor_version => '5' )
413
+ end
414
+
415
+ should "agree that the browser is :name => 'firefox', :build_version => '3'" do
416
+ assert @detector.browser_is?( :name => 'firefox', :build_version => '3' )
417
+ end
418
+
419
+ should "agree that the browser is :name => 'firefox', :revision_version => '0'" do
420
+ assert @detector.browser_is?( :name => 'firefox', :revision_version => '0' )
421
+ end
422
+
423
+ should "agree that the browser is :name => 'firefox', :major_version => '3', :minor_version => '5'" do
424
+ assert @detector.browser_is?( :name => 'firefox', :major_version => '3', :minor_version => '5' )
425
+ end
426
+
427
+ should "agree that the browser is :name => 'firefox', :major_version => '3', :minor_version => '5', :build_version => '3'" do
428
+ assert @detector.browser_is?( :name => 'firefox', :major_version => '3', :minor_version => '5', :build_version => '3' )
429
+ end
430
+
431
+ should "agree that the browser is :name => 'firefox', :major_version => '3', :minor_version => '5', :build_version => '3', :revision_version => '0'" do
432
+ assert @detector.browser_is?( :name => 'firefox', :major_version => '3', :minor_version => '5', :build_version => '3', :revision_version => '0' )
433
+ end
434
+ end
435
+
436
+ context "when given Firefox 3.5 Windows user agent" do
437
+ setup do
438
+ @detector = Guilded::BrowserDetector.new( @user_agents[:firefox35win] )
439
+ assert !@detector.ua.nil?
440
+ end
441
+
442
+ should "agree that the browser name is 'firefox'" do
443
+ assert_equal @detector.browser_name, 'firefox'
444
+ end
445
+
446
+ should "agree that the browser version is '3.5.3'" do
447
+ assert_equal @detector.browser_version, '3.5.3'
448
+ end
449
+
450
+ should "agree that the browser major version is '3'" do
451
+ assert_equal @detector.browser_version_major, '3'
452
+ end
453
+
454
+ should "agree that the browser minor version is '5'" do
455
+ assert_equal @detector.browser_version_minor, '5'
456
+ end
457
+
458
+ should "agree that the browser build version is '3'" do
459
+ assert_equal @detector.browser_version_build, '3'
460
+ end
461
+
462
+ should "agree that the browser revision version is '0'" do
463
+ assert_equal @detector.browser_version_revision, '0'
464
+ end
465
+
466
+ should "have a browser id of 'firefox353'" do
467
+ assert_equal @detector.browser_id, 'firefox353'
468
+ end
469
+
470
+ should "have a browser full name of 'Firefox 3.5.3'" do
471
+ assert_equal @detector.browser_full_name, 'Firefox 3.5.3'
472
+ end
473
+
474
+ should "be able to use a png" do
475
+ assert @detector.can_use_png?
476
+ end
477
+
478
+ should "agree that the browser is :browser => 'firefox'" do
479
+ assert @detector.browser_is?( :name => 'firefox' )
480
+ end
481
+
482
+ should "agree that the browser is :browser => :firefox" do
483
+ assert @detector.browser_is?( :name => :firefox )
484
+ end
485
+
486
+ should "agree that the browser is :version => '3.5.3'" do
487
+ assert @detector.browser_is?( :version => '3.5.3' )
488
+ end
489
+
490
+ should "agree that the browser is :name => 'firefox' and :version => '3.5.3'" do
491
+ assert @detector.browser_is?( :name => 'firefox', :version => '3.5.3' )
492
+ end
493
+
494
+ should "agree that the browser is :name => :firefox and :version => '3.5.3'" do
495
+ assert @detector.browser_is?( :name => :firefox, :version => '3.5.3' )
496
+ end
497
+
498
+ should "agree that the browser is :major_version => '3'" do
499
+ assert @detector.browser_is?( :major_version => '3' )
500
+ end
501
+
502
+ should "agree that the browser is :minor_version => 5'" do
503
+ assert @detector.browser_is?( :minor_version => '5' )
504
+ end
505
+
506
+ should "agree that the browser is :build_version => '3'" do
507
+ assert @detector.browser_is?( :build_version => '3' )
508
+ end
509
+
510
+ should "agree that the browser is :revision_version => '0'" do
511
+ assert @detector.browser_is?( :revision_version => '0' )
512
+ end
513
+
514
+ should "agree that the browser is :major_version => 3" do
515
+ assert @detector.browser_is?( :major_version => 3 )
516
+ end
517
+
518
+ should "agree that the browser is :minor_version => 5" do
519
+ assert @detector.browser_is?( :minor_version => 5 )
520
+ end
521
+
522
+ should "agree that the browser is :build_version => 3" do
523
+ assert @detector.browser_is?( :build_version => 3 )
524
+ end
525
+
526
+ should "agree that the browser is :revision_version => 0" do
527
+ assert @detector.browser_is?( :revision_version => 0 )
528
+ end
529
+
530
+ should "agree that the browser is :major_version => '3', :minor_version => '5'" do
531
+ assert @detector.browser_is?( :major_version => '3', :minor_version => '5' )
532
+ end
533
+
534
+ should "agree that the browser is :major_version => '3', :minor_version => '5', :build_version => '3'" do
535
+ assert @detector.browser_is?( :major_version => '3', :minor_version => '5', :build_version => '3' )
536
+ end
537
+
538
+ should "agree that the browser is :major_version => '3', :minor_version => '5', :build_version => '3', :revision_version => '0'" do
539
+ assert @detector.browser_is?( :major_version => '3', :minor_version => '5', :build_version => '3', :revision_version => '0' )
540
+ end
541
+
542
+ should "agree that the browser is :name => 'firefox', :major_version => '3'" do
543
+ assert @detector.browser_is?( :name => 'firefox', :major_version => '3' )
544
+ end
545
+
546
+ should "agree that the browser is :name => 'firefox', :minor_version => '5'" do
547
+ assert @detector.browser_is?( :name => 'firefox', :minor_version => '5' )
548
+ end
549
+
550
+ should "agree that the browser is :name => 'firefox', :build_version => '3'" do
551
+ assert @detector.browser_is?( :name => 'firefox', :build_version => '3' )
552
+ end
553
+
554
+ should "agree that the browser is :name => 'firefox', :revision_version => '0'" do
555
+ assert @detector.browser_is?( :name => 'firefox', :revision_version => '0' )
556
+ end
557
+
558
+ should "agree that the browser is :name => 'firefox', :major_version => '3', :minor_version => '5'" do
559
+ assert @detector.browser_is?( :name => 'firefox', :major_version => '3', :minor_version => '5' )
560
+ end
561
+
562
+ should "agree that the browser is :name => 'firefox', :major_version => '3', :minor_version => '5', :build_version => '3'" do
563
+ assert @detector.browser_is?( :name => 'firefox', :major_version => '3', :minor_version => '5', :build_version => '3' )
564
+ end
565
+
566
+ should "agree that the browser is :name => 'firefox', :major_version => '3', :minor_version => '5', :build_version => '3', :revision_version => '0'" do
567
+ assert @detector.browser_is?( :name => 'firefox', :major_version => '3', :minor_version => '5', :build_version => '3', :revision_version => '0' )
568
+ end
569
+ end
570
+
571
+ context "when given Opera 10.0 user agent" do
572
+ setup do
573
+ @detector = Guilded::BrowserDetector.new( @user_agents[:opera10] )
574
+ assert !@detector.ua.nil?
575
+ end
576
+
577
+ should "agree that the browser name is 'opera'" do
578
+ assert_equal @detector.browser_name, 'opera'
579
+ end
580
+
581
+ should "agree that the browser version is '10.00'" do
582
+ assert_equal @detector.browser_version, '10.00'
583
+ end
584
+
585
+ should "agree that the browser major version is '10'" do
586
+ assert_equal @detector.browser_version_major, '10'
587
+ end
588
+
589
+ should "agree that the browser minor version is '0'" do
590
+ assert_equal @detector.browser_version_minor, '0'
591
+ end
592
+
593
+ should "agree that the browser build version is '0'" do
594
+ assert_equal @detector.browser_version_build, '0'
595
+ end
596
+
597
+ should "agree that the browser revision version is '0'" do
598
+ assert_equal @detector.browser_version_revision, '0'
599
+ end
600
+
601
+ should "have a browser id of 'opera1000'" do
602
+ assert_equal @detector.browser_id, 'opera1000'
603
+ end
604
+
605
+ should "have a browser full name of 'Opera 10.00'" do
606
+ assert_equal @detector.browser_full_name, 'Opera 10.00'
607
+ end
608
+
609
+ should "be able to use a png" do
610
+ assert @detector.can_use_png?
611
+ end
612
+
613
+ should "agree that the browser is :browser => 'opera'" do
614
+ assert @detector.browser_is?( :name => 'opera' )
615
+ end
616
+
617
+ should "agree that the browser is :browser => opera" do
618
+ assert @detector.browser_is?( :name => :opera )
619
+ end
620
+
621
+ should "agree that the browser is :version => '10.00'" do
622
+ assert @detector.browser_is?( :version => '10.00' )
623
+ end
624
+
625
+ should "agree that the browser is :name => 'opera' and :version => '10.00'" do
626
+ assert @detector.browser_is?( :name => 'opera', :version => '10.00' )
627
+ end
628
+
629
+ should "agree that the browser is :name => :opera and :version => '10.00'" do
630
+ assert @detector.browser_is?( :name => :opera, :version => '10.00' )
631
+ end
632
+
633
+ should "agree that the browser is :major_version => '10'" do
634
+ assert @detector.browser_is?( :major_version => '10' )
635
+ end
636
+
637
+ should "agree that the browser is :minor_version => '0'" do
638
+ assert @detector.browser_is?( :minor_version => '0' )
639
+ end
640
+
641
+ should "agree that the browser is :build_version => '0'" do
642
+ assert @detector.browser_is?( :build_version => '0' )
643
+ end
644
+
645
+ should "agree that the browser is :revision_version => '0'" do
646
+ assert @detector.browser_is?( :revision_version => '0' )
647
+ end
648
+
649
+ should "agree that the browser is :major_version => 10" do
650
+ assert @detector.browser_is?( :major_version => 10 )
651
+ end
652
+
653
+ should "agree that the browser is :minor_version => 0" do
654
+ assert @detector.browser_is?( :minor_version => 0 )
655
+ end
656
+
657
+ should "agree that the browser is :build_version => 0" do
658
+ assert @detector.browser_is?( :build_version => 0 )
659
+ end
660
+
661
+ should "agree that the browser is :revision_version => 0" do
662
+ assert @detector.browser_is?( :revision_version => 0 )
663
+ end
664
+
665
+ should "agree that the browser is :major_version => '10', :minor_version => '0'" do
666
+ assert @detector.browser_is?( :major_version => '10', :minor_version => '0' )
667
+ end
668
+
669
+ should "agree that the browser is :major_version => '10', :minor_version => '0', :build_version => '0'" do
670
+ assert @detector.browser_is?( :major_version => '10', :minor_version => '0', :build_version => '0' )
671
+ end
672
+
673
+ should "agree that the browser is :major_version => '10', :minor_version => '0', :build_version => '0', :revision_version => '0'" do
674
+ assert @detector.browser_is?( :major_version => '10', :minor_version => '0', :build_version => '0', :revision_version => '0' )
675
+ end
676
+
677
+ should "agree that the browser is :name => 'opera', :major_version => '10'" do
678
+ assert @detector.browser_is?( :name => 'opera', :major_version => '10' )
679
+ end
680
+
681
+ should "agree that the browser is :name => 'opera', :minor_version => '0'" do
682
+ assert @detector.browser_is?( :name => 'opera', :minor_version => '0' )
683
+ end
684
+
685
+ should "agree that the browser is :name => 'opera', :build_version => '0'" do
686
+ assert @detector.browser_is?( :name => 'opera', :build_version => '0' )
687
+ end
688
+
689
+ should "agree that the browser is :name => 'opera', :revision_version => '0'" do
690
+ assert @detector.browser_is?( :name => 'opera', :revision_version => '0' )
691
+ end
692
+
693
+ should "agree that the browser is :name => 'opera', :major_version => '10', :minor_version => '0'" do
694
+ assert @detector.browser_is?( :name => 'opera', :major_version => '10', :minor_version => '0' )
695
+ end
696
+
697
+ should "agree that the browser is :name => 'opera', :major_version => '10', :minor_version => '0', :build_version => '0'" do
698
+ assert @detector.browser_is?( :name => 'opera', :major_version => '10', :minor_version => '0', :build_version => '0' )
699
+ end
700
+
701
+ should "agree that the browser is :name => 'opera', :major_version => '10', :minor_version => '0', :build_version => '0', :revision_version => '0'" do
702
+ assert @detector.browser_is?( :name => 'opera', :major_version => '10', :minor_version => '0', :build_version => '0', :revision_version => '0' )
703
+ end
704
+ end
705
+
706
+ context "when given IE 5.5 user agent" do
707
+ setup do
708
+ @detector = Guilded::BrowserDetector.new( @user_agents[:ie55] )
709
+ assert !@detector.ua.nil?
710
+ end
711
+
712
+ should "agree that the browser name is 'ie'" do
713
+ assert_equal @detector.browser_name, 'ie'
714
+ end
715
+
716
+ should "agree that the browser version is '5.5'" do
717
+ assert_equal @detector.browser_version, '5.5'
718
+ end
719
+
720
+ should "agree that the browser major version is '5'" do
721
+ assert_equal @detector.browser_version_major, '5'
722
+ end
723
+
724
+ should "agree that the browser minor version is '5'" do
725
+ assert_equal @detector.browser_version_minor, '5'
726
+ end
727
+
728
+ should "agree that the browser build version is '0'" do
729
+ assert_equal @detector.browser_version_build, '0'
730
+ end
731
+
732
+ should "agree that the browser revision version is '0'" do
733
+ assert_equal @detector.browser_version_revision, '0'
734
+ end
735
+
736
+ should "have a browser id of 'ie55'" do
737
+ assert_equal @detector.browser_id, 'ie55'
738
+ end
739
+
740
+ should "have a browser full name of 'Internet Explorer 5.5'" do
741
+ assert_equal @detector.browser_full_name, 'Internet Explorer 5.5'
742
+ end
743
+
744
+ should "not be able to use a png" do
745
+ assert !@detector.can_use_png?
746
+ end
747
+
748
+ should "agree that the browser is :browser => 'ie'" do
749
+ assert @detector.browser_is?( :name => 'ie' )
750
+ end
751
+
752
+ should "agree that the browser is :browser => :ie" do
753
+ assert @detector.browser_is?( :name => :ie )
754
+ end
755
+
756
+ should "agree that the browser is :version => '5.5'" do
757
+ assert @detector.browser_is?( :version => '5.5' )
758
+ end
759
+
760
+ should "agree that the browser is :name => 'ie' and :version => '5.5'" do
761
+ assert @detector.browser_is?( :name => 'ie', :version => '5.5' )
762
+ end
763
+
764
+ should "agree that the browser is :name => :ie and :version => '5.5'" do
765
+ assert @detector.browser_is?( :name => :ie, :version => '5.5' )
766
+ end
767
+
768
+ should "agree that the browser is :major_version => '5'" do
769
+ assert @detector.browser_is?( :major_version => '5' )
770
+ end
771
+
772
+ should "agree that the browser is :minor_version => '5'" do
773
+ assert @detector.browser_is?( :minor_version => '5' )
774
+ end
775
+
776
+ should "agree that the browser is :build_version => '0'" do
777
+ assert @detector.browser_is?( :build_version => '0' )
778
+ end
779
+
780
+ should "agree that the browser is :revision_version => '0'" do
781
+ assert @detector.browser_is?( :revision_version => '0' )
782
+ end
783
+
784
+ should "agree that the browser is :major_version => 5" do
785
+ assert @detector.browser_is?( :major_version => 5 )
786
+ end
787
+
788
+ should "agree that the browser is :minor_version => 5" do
789
+ assert @detector.browser_is?( :minor_version => 5 )
790
+ end
791
+
792
+ should "agree that the browser is :build_version => 0" do
793
+ assert @detector.browser_is?( :build_version => 0 )
794
+ end
795
+
796
+ should "agree that the browser is :revision_version => 0" do
797
+ assert @detector.browser_is?( :revision_version => 0 )
798
+ end
799
+
800
+ should "agree that the browser is :major_version => '5', :minor_version => '5'" do
801
+ assert @detector.browser_is?( :major_version => '5', :minor_version => '5' )
802
+ end
803
+
804
+ should "agree that the browser is :major_version => '5', :minor_version => '5', :build_version => '0'" do
805
+ assert @detector.browser_is?( :major_version => '5', :minor_version => '5', :build_version => '0' )
806
+ end
807
+
808
+ should "agree that the browser is :major_version => '5', :minor_version => '5', :build_version => '0', :revision_version => '0'" do
809
+ assert @detector.browser_is?( :major_version => '5', :minor_version => '5', :build_version => '0', :revision_version => '0' )
810
+ end
811
+
812
+ should "agree that the browser is :name => 'ie', :major_version => '5'" do
813
+ assert @detector.browser_is?( :name => 'ie', :major_version => '5' )
814
+ end
815
+
816
+ should "agree that the browser is :name => 'ie', :minor_version => '5'" do
817
+ assert @detector.browser_is?( :name => 'ie', :minor_version => '5' )
818
+ end
819
+
820
+ should "agree that the browser is :name => 'ie', :build_version => '0'" do
821
+ assert @detector.browser_is?( :name => 'ie', :build_version => '0' )
822
+ end
823
+
824
+ should "agree that the browser is :name => 'ie', :revision_version => '0'" do
825
+ assert @detector.browser_is?( :name => 'ie', :revision_version => '0' )
826
+ end
827
+
828
+ should "agree that the browser is :name => 'ie', :major_version => '5', :minor_version => '5'" do
829
+ assert @detector.browser_is?( :name => 'ie', :major_version => '5', :minor_version => '5' )
830
+ end
831
+
832
+ should "agree that the browser is :name => 'ie', :major_version => '5', :minor_version => '5', :build_version => '0'" do
833
+ assert @detector.browser_is?( :name => 'ie', :major_version => '5', :minor_version => '5', :build_version => '0' )
834
+ end
835
+
836
+ should "agree that the browser is :name => 'ie', :major_version => '5', :minor_version => '5', :build_version => '0', :revision_version => '0'" do
837
+ assert @detector.browser_is?( :name => 'ie', :major_version => '5', :minor_version => '5', :build_version => '0', :revision_version => '0' )
838
+ end
839
+ end
840
+
841
+ context "when given IE 6.0 user agent" do
842
+ setup do
843
+ @detector = Guilded::BrowserDetector.new( @user_agents[:ie60] )
844
+ assert !@detector.ua.nil?
845
+ end
846
+
847
+ should "agree that the browser name is 'ie'" do
848
+ assert_equal @detector.browser_name, 'ie'
849
+ end
850
+
851
+ should "agree that the browser version is '6.0'" do
852
+ assert_equal @detector.browser_version, '6.0'
853
+ end
854
+
855
+ should "agree that the browser major version is '6'" do
856
+ assert_equal @detector.browser_version_major, '6'
857
+ end
858
+
859
+ should "agree that the browser minor version is '0'" do
860
+ assert_equal @detector.browser_version_minor, '0'
861
+ end
862
+
863
+ should "agree that the browser build version is '0'" do
864
+ assert_equal @detector.browser_version_build, '0'
865
+ end
866
+
867
+ should "agree that the browser revision version is '0'" do
868
+ assert_equal @detector.browser_version_revision, '0'
869
+ end
870
+
871
+ should "have a browser id of 'ie60'" do
872
+ assert_equal @detector.browser_id, 'ie60'
873
+ end
874
+
875
+ should "have a browser full name of 'Internet Explorer 6.0'" do
876
+ assert_equal @detector.browser_full_name, 'Internet Explorer 6.0'
877
+ end
878
+
879
+ should "not be able to use a png" do
880
+ assert !@detector.can_use_png?
881
+ end
882
+
883
+ should "agree that the browser is :browser => 'ie'" do
884
+ assert @detector.browser_is?( :name => 'ie' )
885
+ end
886
+
887
+ should "agree that the browser is :browser => :ie" do
888
+ assert @detector.browser_is?( :name => :ie )
889
+ end
890
+
891
+ should "agree that the browser is :version => '6.0'" do
892
+ assert @detector.browser_is?( :version => '6.0' )
893
+ end
894
+
895
+ should "agree that the browser is :name => 'ie' and :version => '6.0'" do
896
+ assert @detector.browser_is?( :name => 'ie', :version => '6.0' )
897
+ end
898
+
899
+ should "agree that the browser is :name => :ie and :version => '6.0'" do
900
+ assert @detector.browser_is?( :name => :ie, :version => '6.0' )
901
+ end
902
+
903
+ should "agree that the browser is :major_version => '6'" do
904
+ assert @detector.browser_is?( :major_version => '6' )
905
+ end
906
+
907
+ should "agree that the browser is :minor_version => '0'" do
908
+ assert @detector.browser_is?( :minor_version => '0' )
909
+ end
910
+
911
+ should "agree that the browser is :build_version => '0'" do
912
+ assert @detector.browser_is?( :build_version => '0' )
913
+ end
914
+
915
+ should "agree that the browser is :revision_version => '0'" do
916
+ assert @detector.browser_is?( :revision_version => '0' )
917
+ end
918
+
919
+ should "agree that the browser is :major_version => 6" do
920
+ assert @detector.browser_is?( :major_version => 6 )
921
+ end
922
+
923
+ should "agree that the browser is :minor_version => 0" do
924
+ assert @detector.browser_is?( :minor_version => 0 )
925
+ end
926
+
927
+ should "agree that the browser is :build_version => 0" do
928
+ assert @detector.browser_is?( :build_version => 0 )
929
+ end
930
+
931
+ should "agree that the browser is :revision_version => 0" do
932
+ assert @detector.browser_is?( :revision_version => 0 )
933
+ end
934
+
935
+ should "agree that the browser is :major_version => '6', :minor_version => '0'" do
936
+ assert @detector.browser_is?( :major_version => '6', :minor_version => '0' )
937
+ end
938
+
939
+ should "agree that the browser is :major_version => '6', :minor_version => '0', :build_version => '0'" do
940
+ assert @detector.browser_is?( :major_version => '6', :minor_version => '0', :build_version => '0' )
941
+ end
942
+
943
+ should "agree that the browser is :major_version => '6', :minor_version => '0', :build_version => '0', :revision_version => '0'" do
944
+ assert @detector.browser_is?( :major_version => '6', :minor_version => '0', :build_version => '0', :revision_version => '0' )
945
+ end
946
+
947
+ should "agree that the browser is :name => 'ie', :major_version => '6'" do
948
+ assert @detector.browser_is?( :name => 'ie', :major_version => '6' )
949
+ end
950
+
951
+ should "agree that the browser is :name => 'ie', :minor_version => '0'" do
952
+ assert @detector.browser_is?( :name => 'ie', :minor_version => '0' )
953
+ end
954
+
955
+ should "agree that the browser is :name => 'ie', :build_version => '0'" do
956
+ assert @detector.browser_is?( :name => 'ie', :build_version => '0' )
957
+ end
958
+
959
+ should "agree that the browser is :name => 'ie', :revision_version => '0'" do
960
+ assert @detector.browser_is?( :name => 'ie', :revision_version => '0' )
961
+ end
962
+
963
+ should "agree that the browser is :name => 'ie', :major_version => '6', :minor_version => '0'" do
964
+ assert @detector.browser_is?( :name => 'ie', :major_version => '6', :minor_version => '0' )
965
+ end
966
+
967
+ should "agree that the browser is :name => 'ie', :major_version => '6', :minor_version => '0', :build_version => '0'" do
968
+ assert @detector.browser_is?( :name => 'ie',:major_version => '6', :minor_version => '0', :build_version => '0' )
969
+ end
970
+
971
+ should "agree that the browser is :name => 'ie', :major_version => '6', :minor_version => '0', :build_version => '0', :revision_version => '0'" do
972
+ assert @detector.browser_is?( :name => 'ie', :major_version => '6', :minor_version => '0', :build_version => '0', :revision_version => '0' )
973
+ end
974
+ end
975
+
976
+ context "when given IE 7.0 user agent" do
977
+ setup do
978
+ @detector = Guilded::BrowserDetector.new( @user_agents[:ie70] )
979
+ assert !@detector.ua.nil?
980
+ end
981
+
982
+ should "agree that the browser name is 'ie'" do
983
+ assert_equal @detector.browser_name, 'ie'
984
+ end
985
+
986
+ should "agree that the browser version is '7.0'" do
987
+ assert_equal @detector.browser_version, '7.0'
988
+ end
989
+
990
+ should "agree that the browser major version is '7'" do
991
+ assert_equal @detector.browser_version_major, '7'
992
+ end
993
+
994
+ should "agree that the browser minor version is '0'" do
995
+ assert_equal @detector.browser_version_minor, '0'
996
+ end
997
+
998
+ should "agree that the browser build version is '0'" do
999
+ assert_equal @detector.browser_version_build, '0'
1000
+ end
1001
+
1002
+ should "agree that the browser revision version is '0'" do
1003
+ assert_equal @detector.browser_version_revision, '0'
1004
+ end
1005
+
1006
+ should "have a browser id of 'ie70'" do
1007
+ assert_equal @detector.browser_id, 'ie70'
1008
+ end
1009
+
1010
+ should "have a browser full name of 'Internet Explorer 7.0'" do
1011
+ assert_equal @detector.browser_full_name, 'Internet Explorer 7.0'
1012
+ end
1013
+
1014
+ should "be able to use a png" do
1015
+ assert @detector.can_use_png?
1016
+ end
1017
+
1018
+ should "agree that the browser is :browser => 'ie'" do
1019
+ assert @detector.browser_is?( :name => 'ie' )
1020
+ end
1021
+
1022
+ should "agree that the browser is :browser => :ie" do
1023
+ assert @detector.browser_is?( :name => :ie )
1024
+ end
1025
+
1026
+ should "agree that the browser is :version => '7.0'" do
1027
+ assert @detector.browser_is?( :version => '7.0' )
1028
+ end
1029
+
1030
+ should "agree that the browser is :name => 'ie' and :version => '7.0'" do
1031
+ assert @detector.browser_is?( :name => 'ie', :version => '7.0' )
1032
+ end
1033
+
1034
+ should "agree that the browser is :name => :ie and :version => '7.0'" do
1035
+ assert @detector.browser_is?( :name => :ie, :version => '7.0' )
1036
+ end
1037
+
1038
+ should "agree that the browser is :major_version => '7'" do
1039
+ assert @detector.browser_is?( :major_version => '7' )
1040
+ end
1041
+
1042
+ should "agree that the browser is :minor_version => '0'" do
1043
+ assert @detector.browser_is?( :minor_version => '0' )
1044
+ end
1045
+
1046
+ should "agree that the browser is :build_version => '0'" do
1047
+ assert @detector.browser_is?( :build_version => '0' )
1048
+ end
1049
+
1050
+ should "agree that the browser is :revision_version => '0'" do
1051
+ assert @detector.browser_is?( :revision_version => '0' )
1052
+ end
1053
+
1054
+ should "agree that the browser is :major_version => 7" do
1055
+ assert @detector.browser_is?( :major_version => 7 )
1056
+ end
1057
+
1058
+ should "agree that the browser is :minor_version => 0" do
1059
+ assert @detector.browser_is?( :minor_version => 0 )
1060
+ end
1061
+
1062
+ should "agree that the browser is :build_version => 0" do
1063
+ assert @detector.browser_is?( :build_version => 0 )
1064
+ end
1065
+
1066
+ should "agree that the browser is :revision_version => 0" do
1067
+ assert @detector.browser_is?( :revision_version => 0 )
1068
+ end
1069
+
1070
+ should "agree that the browser is :major_version => '7', :minor_version => '0'" do
1071
+ assert @detector.browser_is?( :major_version => '7', :minor_version => '0' )
1072
+ end
1073
+
1074
+ should "agree that the browser is :major_version => '7', :minor_version => '0', :build_version => '0'" do
1075
+ assert @detector.browser_is?( :major_version => '7', :minor_version => '0', :build_version => '0' )
1076
+ end
1077
+
1078
+ should "agree that the browser is :major_version => '7', :minor_version => '0', :build_version => '0', :revision_version => '0'" do
1079
+ assert @detector.browser_is?( :major_version => '7', :minor_version => '0', :build_version => '0', :revision_version => '0' )
1080
+ end
1081
+
1082
+ should "agree that the browser is :name => 'ie', :major_version => '7'" do
1083
+ assert @detector.browser_is?( :name => 'ie', :major_version => '7' )
1084
+ end
1085
+
1086
+ should "agree that the browser is :name => 'ie', :minor_version => '0'" do
1087
+ assert @detector.browser_is?( :name => 'ie', :minor_version => '0' )
1088
+ end
1089
+
1090
+ should "agree that the browser is :name => 'ie', :build_version => '0'" do
1091
+ assert @detector.browser_is?( :name => 'ie', :build_version => '0' )
1092
+ end
1093
+
1094
+ should "agree that the browser is :name => 'ie', :revision_version => '0'" do
1095
+ assert @detector.browser_is?( :name => 'ie', :revision_version => '0' )
1096
+ end
1097
+
1098
+ should "agree that the browser is :name => 'ie', :major_version => '7', :minor_version => '0'" do
1099
+ assert @detector.browser_is?( :name => 'ie', :major_version => '7', :minor_version => '0' )
1100
+ end
1101
+
1102
+ should "agree that the browser is :name => 'ie', :major_version => '7', :minor_version => '0', :build_version => '0'" do
1103
+ assert @detector.browser_is?( :name => 'ie',:major_version => '7', :minor_version => '0', :build_version => '0' )
1104
+ end
1105
+
1106
+ should "agree that the browser is :name => 'ie', :major_version => '7', :minor_version => '0', :build_version => '0', :revision_version => '0'" do
1107
+ assert @detector.browser_is?( :name => 'ie', :major_version => '7', :minor_version => '0', :build_version => '0', :revision_version => '0' )
1108
+ end
1109
+ end
1110
+
1111
+ context "when given IE 8.0 user agent" do
1112
+ setup do
1113
+ @detector = Guilded::BrowserDetector.new( @user_agents[:ie80] )
1114
+ assert !@detector.ua.nil?
1115
+ end
1116
+
1117
+ should "agree that the browser name is 'ie'" do
1118
+ assert_equal @detector.browser_name, 'ie'
1119
+ end
1120
+
1121
+ should "agree that the browser version is '8.0'" do
1122
+ assert_equal @detector.browser_version, '8.0'
1123
+ end
1124
+
1125
+ should "agree that the browser major version is '8'" do
1126
+ assert_equal @detector.browser_version_major, '8'
1127
+ end
1128
+
1129
+ should "agree that the browser minor version is '0'" do
1130
+ assert_equal @detector.browser_version_minor, '0'
1131
+ end
1132
+
1133
+ should "agree that the browser build version is '0'" do
1134
+ assert_equal @detector.browser_version_build, '0'
1135
+ end
1136
+
1137
+ should "agree that the browser revision version is '0'" do
1138
+ assert_equal @detector.browser_version_revision, '0'
1139
+ end
1140
+
1141
+ should "have a browser id of 'ie80'" do
1142
+ assert_equal @detector.browser_id, 'ie80'
1143
+ end
1144
+
1145
+ should "have a browser full name of 'Internet Explorer 8.0'" do
1146
+ assert_equal @detector.browser_full_name, 'Internet Explorer 8.0'
1147
+ end
1148
+
1149
+ should "be able to use a png" do
1150
+ assert @detector.can_use_png?
1151
+ end
1152
+
1153
+ should "agree that the browser is :browser => 'ie'" do
1154
+ assert @detector.browser_is?( :name => 'ie' )
1155
+ end
1156
+
1157
+ should "agree that the browser is :browser => :ie" do
1158
+ assert @detector.browser_is?( :name => :ie )
1159
+ end
1160
+
1161
+ should "agree that the browser is :version => '8.0'" do
1162
+ assert @detector.browser_is?( :version => '8.0' )
1163
+ end
1164
+
1165
+ should "agree that the browser is :name => 'ie' and :version => '8.0'" do
1166
+ assert @detector.browser_is?( :name => 'ie', :version => '8.0' )
1167
+ end
1168
+
1169
+ should "agree that the browser is :name => :ie and :version => '8.0'" do
1170
+ assert @detector.browser_is?( :name => :ie, :version => '8.0' )
1171
+ end
1172
+
1173
+ #
1174
+ should "agree that the browser is :major_version => '8'" do
1175
+ assert @detector.browser_is?( :major_version => '8' )
1176
+ end
1177
+
1178
+ should "agree that the browser is :minor_version => '0'" do
1179
+ assert @detector.browser_is?( :minor_version => '0' )
1180
+ end
1181
+
1182
+ should "agree that the browser is :build_version => '0'" do
1183
+ assert @detector.browser_is?( :build_version => '0' )
1184
+ end
1185
+
1186
+ should "agree that the browser is :revision_version => '0'" do
1187
+ assert @detector.browser_is?( :revision_version => '0' )
1188
+ end
1189
+
1190
+ should "agree that the browser is :major_version => 8" do
1191
+ assert @detector.browser_is?( :major_version => 8 )
1192
+ end
1193
+
1194
+ should "agree that the browser is :minor_version => 0" do
1195
+ assert @detector.browser_is?( :minor_version => 0 )
1196
+ end
1197
+
1198
+ should "agree that the browser is :build_version => 0" do
1199
+ assert @detector.browser_is?( :build_version => 0 )
1200
+ end
1201
+
1202
+ should "agree that the browser is :revision_version => 0" do
1203
+ assert @detector.browser_is?( :revision_version => 0 )
1204
+ end
1205
+
1206
+ should "agree that the browser is :major_version => '8', :minor_version => '0'" do
1207
+ assert @detector.browser_is?( :major_version => '8', :minor_version => '0' )
1208
+ end
1209
+
1210
+ should "agree that the browser is :major_version => '8', :minor_version => '0', :build_version => '0'" do
1211
+ assert @detector.browser_is?( :major_version => '8', :minor_version => '0', :build_version => '0' )
1212
+ end
1213
+
1214
+ should "agree that the browser is :major_version => '8', :minor_version => '0', :build_version => '0', :revision_version => '0'" do
1215
+ assert @detector.browser_is?( :major_version => '8', :minor_version => '0', :build_version => '0', :revision_version => '0' )
1216
+ end
1217
+
1218
+ should "agree that the browser is :name => 'ie', :major_version => '8'" do
1219
+ assert @detector.browser_is?( :name => 'ie', :major_version => '8' )
1220
+ end
1221
+
1222
+ should "agree that the browser is :name => 'ie', :minor_version => '0'" do
1223
+ assert @detector.browser_is?( :name => 'ie', :minor_version => '0' )
1224
+ end
1225
+
1226
+ should "agree that the browser is :name => 'ie', :build_version => '0'" do
1227
+ assert @detector.browser_is?( :name => 'ie', :build_version => '0' )
1228
+ end
1229
+
1230
+ should "agree that the browser is :name => 'ie', :revision_version => '0'" do
1231
+ assert @detector.browser_is?( :name => 'ie', :revision_version => '0' )
1232
+ end
1233
+
1234
+ should "agree that the browser is :name => 'ie', :major_version => '8', :minor_version => '0'" do
1235
+ assert @detector.browser_is?( :name => 'ie', :major_version => '8', :minor_version => '0' )
1236
+ end
1237
+
1238
+ should "agree that the browser is :name => 'ie', :major_version => '8', :minor_version => '0', :build_version => '0'" do
1239
+ assert @detector.browser_is?( :name => 'ie',:major_version => '8', :minor_version => '0', :build_version => '0' )
1240
+ end
1241
+
1242
+ should "agree that the browser is :name => 'ie', :major_version => '8', :minor_version => '0', :build_version => '0', :revision_version => '0'" do
1243
+ assert @detector.browser_is?( :name => 'ie', :major_version => '8', :minor_version => '0', :build_version => '0', :revision_version => '0' )
1244
+ end
1245
+ end
1246
+
1247
+ end
1248
+ end