schmobile 0.1.2 → 0.1.3

Sign up to get free protection for your applications and to get access to all the features.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.1.2
1
+ 0.1.3
@@ -9,6 +9,10 @@ module Rack
9
9
 
10
10
  false
11
11
  end
12
+
13
+ def is_device?(identifier)
14
+ user_agent =~ /#{identifier}/i
15
+ end
12
16
  end
13
17
  end
14
18
  end
data/schmobile.gemspec CHANGED
@@ -5,7 +5,7 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{schmobile}
8
- s.version = "0.1.2"
8
+ s.version = "0.1.3"
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"]
@@ -3,6 +3,17 @@ require 'helper'
3
3
  class TestRackRequest < Test::Unit::TestCase
4
4
 
5
5
  context "Rack::Request" do
6
+ context "#is_device?" do
7
+ should "match devices as part of the user agent case insensitively" do
8
+ assert request("HTTP_USER_AGENT" => ipad).is_device?("ipad")
9
+ assert !request("HTTP_USER_AGENT" => ipad).is_device?("blackberry")
10
+ assert request("HTTP_USER_AGENT" => blackberry).is_device?("blackberry")
11
+ assert !request("HTTP_USER_AGENT" => iphone).is_device?("blackberry")
12
+ assert request("HTTP_USER_AGENT" => iphone).is_device?("iphone")
13
+ assert !request("HTTP_USER_AGENT" => msie6).is_device?("iphone")
14
+ end
15
+ end
16
+
6
17
  context "#is_mobile?" do
7
18
  context "without params" do
8
19
  setup do
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: 31
4
+ hash: 29
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 1
9
- - 2
10
- version: 0.1.2
9
+ - 3
10
+ version: 0.1.3
11
11
  platform: ruby
12
12
  authors:
13
13
  - Morten Primdahl