Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Added a unit test for iPad detection, updated changelog in preparation

for 0.4.0 release.
  • Loading branch information...
commit e6f5816dfd86acd68fa54a9c18d3830dd8b69d09 1 parent 4fa61b4
@talison authored
Showing with 10 additions and 0 deletions.
  1. +3 −0  CHANGELOG.md
  2. +7 −0 test/test_rack-mobile-detect.rb
View
3  CHANGELOG.md
@@ -1,3 +1,6 @@
+### 0.4.0: Jun 7, 2012 ###
+* Added iPad detection, thank you sansari (https://github.com/sansari)
+
### 0.3.0: Mar 12, 2011 ###
* Modified catch-all based: https://github.com/brendanlim/mobile-fu
View
7 test/test_rack-mobile-detect.rb
@@ -26,6 +26,10 @@ class TestRackMobileDetect < Test::Unit::TestCase
env = test_env({ 'HTTP_USER_AGENT' => android })
@rack.call(env)
assert_equal 'Android', env[x_mobile]
+
+ env = test_env({ 'HTTP_USER_AGENT' => ipad })
+ @rack.call(env)
+ assert_equal 'iPad', env[x_mobile]
end
should "detect UAProf device" do
@@ -226,6 +230,9 @@ def x_mobile
end
# User agents for testing
+ def ipad
+ 'Mozilla/5.0 (iPad; U; CPU OS 3_2 like Mac OS X; en-us) AppleWebKit/531.21.10 (KHTML, like Gecko) Version/4.0.4 Mobile/7B334b Safari/531.21.10'
+ end
def ipod
'Mozilla/5.0 (iPod; U; CPU iPhone OS 2_2 like Mac OS X; en-us) AppleWebKit/525.18.1 (KHTML, like Gecko) Version/3.1.1 Mobile/5G77 Safari/525.20'
end
Please sign in to comment.
Something went wrong with that request. Please try again.