schmobile 0.3.1 → 0.3.2

Sign up to get free protection for your applications and to get access to all the features.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.3.1
1
+ 0.3.2
@@ -3,10 +3,10 @@ module Rack
3
3
  class UserAgents
4
4
 
5
5
  MOBILE_USER_AGENTS = %w(
6
- alcatel amoi android astel audiovox blackberry cdm ce chtml danger docomo ericsson htc_touch
6
+ alcatel amoi android astel audiovox blackberry cdm chtml danger docomo ericsson htc_touch
7
7
  iphone ipod j2me kddi midp minimo mmp mobi mobile mobileexplorer mot- motorola netfront nokia
8
8
  novarra palm pdxgw phone plucker pocket portable portalmmm sagem samsung sgh sie- softbank
9
- sprint symbian telit ucweb up.b upg1 vodafone webos windows x240 x320 xiino
9
+ sprint symbian telit ucweb up.b upg1 vodafone webos windows\ ce x240 x320 xiino
10
10
  )
11
11
 
12
12
  def self.remove_user_agent_pattern(pattern)
data/schmobile.gemspec CHANGED
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{schmobile}
8
- s.version = "0.3.1"
8
+ s.version = "0.3.2"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Morten Primdahl"]
12
- s.date = %q{2011-05-27}
12
+ s.date = %q{2011-05-31}
13
13
  s.description = %q{Used to determine if a request is from a mobile client, and possibly redirect it if that's the case}
14
14
  s.email = %q{morten@zendesk.com}
15
15
  s.extra_rdoc_files = [
data/test/helper.rb CHANGED
@@ -53,6 +53,10 @@ class Test::Unit::TestCase
53
53
  "Client: Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.0; WOW64; Trident/4.0; SLCC1; .NET CLR 2.0.50727; Media Center PC 5.0; MDDR; .NET CLR 3.5.30729; InfoPath.2; .NET CLR 3.0.30729; OfficeLiveConnector.1.3; OfficeLivePatch.0.0; .NET CLR 4.0.20506; Creative AutoUpdate v1.40.01)"
54
54
  end
55
55
 
56
+ def chrome
57
+ "Mozilla/5.0 (Windows NT 5.1) AppleWebKit/534.24 (KHTML, like Gecko) Chrome/11.0.696.71 Safari/534.24"
58
+ end
59
+
56
60
  def opera
57
61
  "Opera/9.25 (Windows NT 6.0; U; en)"
58
62
  end
@@ -38,9 +38,9 @@ class TestRackRequest < Test::Unit::TestCase
38
38
  assert !request.is_mobile?
39
39
  assert !request("HTTP_USER_AGENT" => nil).is_mobile?
40
40
 
41
- [ :msie6, :msie8, :opera ].each do |browser|
41
+ [ :msie6, :msie8, :opera, :chrome ].each do |browser|
42
42
  agent = self.send(browser)
43
- assert request("HTTP_USER_AGENT" => agent).is_mobile?
43
+ assert !request("HTTP_USER_AGENT" => agent).is_mobile?
44
44
  end
45
45
  end
46
46
 
@@ -18,6 +18,15 @@ class TestUserAgents < Test::Unit::TestCase
18
18
  assert Rack::Schmobile::UserAgents.is_mobile_agent?("wibble")
19
19
  end
20
20
  end
21
+
22
+ context "#is_mobile_agent?" do
23
+ should "return false for common browsers" do
24
+ [ :msie6, :msie8, :opera, :chrome ].each do |browser|
25
+ agent = self.send(browser)
26
+ assert !Rack::Schmobile::UserAgents.is_mobile_agent?(agent), "#{browser} should not detect as mobile, #{agent}"
27
+ end
28
+ end
29
+ end
21
30
  end
22
31
 
23
32
  end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: schmobile
3
3
  version: !ruby/object:Gem::Version
4
- hash: 17
4
+ hash: 23
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 3
9
- - 1
10
- version: 0.3.1
9
+ - 2
10
+ version: 0.3.2
11
11
  platform: ruby
12
12
  authors:
13
13
  - Morten Primdahl
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2011-05-27 00:00:00 -07:00
18
+ date: 2011-05-31 00:00:00 -07:00
19
19
  default_executable:
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency