Permalink
Browse files

Meta-testing agents

  • Loading branch information...
1 parent 64b4a06 commit 36ffea6b688bcec700276e80ea701143e8d801c5 @tj committed Aug 28, 2009
Showing with 21 additions and 0 deletions.
  1. +21 −0 spec/agents_spec.rb
View
@@ -0,0 +1,21 @@
+
+require File.dirname(__FILE__) + '/spec_helper'
+
+describe Agent do
+ describe "Safari" do
+ [
+ ['4.0dp1', 'Mozilla/5.0 (Windows; U; Windows NT 5.1; en) AppleWebKit/526.9 (KHTML, like Gecko) Version/4.0dp1 Safari/526.8'],
+ ['4.0dp1', 'Mozilla/5.0 (Macintosh; U; PPC Mac OS X 10.5; en-US; rv:1.9.1b3pre) Gecko/20081212 Mozilla/5.0 (Windows; U; Windows NT 5.1; en) AppleWebKit/526.9 (KHTML, like Gecko) Version/4.0dp1 Safari/526.8'],
+ ['4.0.3', 'Mozilla/5.0 (Windows; U; Windows NT 6.0; en-us) AppleWebKit/531.9 (KHTML, like Gecko) Version/4.0.3 Safari/531.9'],
+ ['4.0.2', 'Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US) AppleWebKit/532+ (KHTML, like Gecko) Version/4.0.2 Safari/530.19.1'],
+ ['4.0.1', 'Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10_5_7; en-us) AppleWebKit/531.2+ (KHTML, like Gecko) Version/4.0.1 Safari/530.18'],
+ ['4.0', 'Mozilla/5.0 (Windows; U; Windows NT 6.0; ru-RU) AppleWebKit/528.16 (KHTML, like Gecko) Version/4.0 Safari/528.16'],
+ ['3.2.3', 'Mozilla/5.0 (Windows; U; Windows NT 5.1; cs-CZ) AppleWebKit/525.28.3 (KHTML, like Gecko) Version/3.2.3 Safari/525.29'],
+ ].each do |version, string|
+ it "should parse version '#{version}'" do
+ Agent.new(string).name.should == :Safari
+ Agent.new(string).version.should == version
+ end
+ end
+ end
+end

0 comments on commit 36ffea6

Please sign in to comment.