Browse files

Added new Windows x86 Gecko UA compatibility

  • Loading branch information...
1 parent ee832c8 commit 4287b075a02f8e9bdb58a69c6b599c4cbc726e6f @gshutler committed Dec 27, 2012
Showing with 35 additions and 5 deletions.
  1. +7 −5 lib/user_agent/browsers/gecko.rb
  2. +28 −0 spec/browsers/gecko_user_agent_spec.rb
View
12 lib/user_agent/browsers/gecko.rb
@@ -24,7 +24,7 @@ def platform
if comment = application.comment
if comment[0] == 'compatible'
nil
- elsif comment[1] == 'WOW64' || comment[1] == 'Win64'
+ elsif /^Windows / =~ comment[0]
'Windows'
else
comment[0]
@@ -38,10 +38,12 @@ def security
def os
if comment = application.comment
- i = case comment[1]
- when 'U'; 2
- when 'WOW64', 'Win64'; 0
- else 1
+ i = if comment[1] == 'U'
+ 2
+ elsif /^Windows / =~ comment[0]
+ 0
+ else
+ 1
end
OperatingSystems.normalize_os(comment[i])
View
28 spec/browsers/gecko_user_agent_spec.rb
@@ -215,6 +215,34 @@
end
end
+describe 'UserAgent: Mozilla/5.0 (Windows NT 6.1; rv:17.0) Gecko/20100101 Firefox/17.0' do
+ before do
+ @useragent = UserAgent.parse('Mozilla/5.0 (Windows NT 6.1; rv:17.0) Gecko/20100101 Firefox/17.0')
+ end
+
+ it_should_behave_like "Firefox browser"
+
+ it "should return '17.0' as its version" do
+ @useragent.version.should == "17.0"
+ end
+
+ it "should return '20100101' as its gecko version" do
+ @useragent.gecko.version.should == "20100101"
+ end
+
+ it "should return 'Windows' as its platform" do
+ @useragent.platform.should == "Windows"
+ end
+
+ it "should return 'Windows 7' as its os" do
+ @useragent.os.should == "Windows 7"
+ end
+
+ it "should return nil as its localization" do
+ @useragent.localization.should be_nil
+ end
+end
+
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
before do
@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")

0 comments on commit 4287b07

Please sign in to comment.