Skip to content

Commit

Permalink
Added a unit test for iPad detection, updated changelog in preparation
Browse files Browse the repository at this point in the history
for 0.4.0 release.
  • Loading branch information
talison committed Jun 8, 2012
1 parent 4fa61b4 commit e6f5816
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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

Expand Down
7 changes: 7 additions & 0 deletions test/test_rack-mobile-detect.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit e6f5816

Please sign in to comment.