rack-ketai 0.2.0 → 0.2.1
Sign up to get free protection for your applications and to get access to all the features.
- data/VERSION +1 -1
- data/lib/rack/ketai/carrier/general.rb +2 -0
- data/rack-ketai.gemspec +3 -2
- data/spec/unit/general_spec.rb +41 -0
- metadata +6 -4
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.2.
|
1
|
+
0.2.1
|
data/rack-ketai.gemspec
CHANGED
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{rack-ketai}
|
8
|
-
s.version = "0.2.
|
8
|
+
s.version = "0.2.1"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Yuichi Takeuchi"]
|
12
|
-
s.date = %q{2010-11-
|
12
|
+
s.date = %q{2010-11-16}
|
13
13
|
s.email = %q{info@takeyu-web.com}
|
14
14
|
s.extra_rdoc_files = [
|
15
15
|
"README.rdoc"
|
@@ -88,6 +88,7 @@ Gem::Specification.new do |s|
|
|
88
88
|
"spec/unit/docomo_spec.rb",
|
89
89
|
"spec/unit/display_spec.rb",
|
90
90
|
"spec/unit/docomo_filter_spec.rb",
|
91
|
+
"spec/unit/general_spec.rb",
|
91
92
|
"spec/unit/iphone_spec.rb",
|
92
93
|
"spec/unit/softbank_spec.rb",
|
93
94
|
"spec/unit/carrier_spec.rb",
|
@@ -0,0 +1,41 @@
|
|
1
|
+
# -*- coding: utf-8 -*-
|
2
|
+
require 'rack/ketai/carrier/general'
|
3
|
+
describe "Rack::Ketai::Carrier::General" do
|
4
|
+
|
5
|
+
describe 'PCでのアクセスのとき' do
|
6
|
+
|
7
|
+
before(:each) do
|
8
|
+
@env = Rack::MockRequest.env_for('http://hoge.com/dummy',
|
9
|
+
'HTTP_USER_AGENT' => 'Mozilla/5.0 (Windows; U; Windows NT 6.1; ja; rv:1.9.2.12) Gecko/20101026 Firefox/3.6.12 ( .NET CLR 3.5.30729; .NET4.0E)',
|
10
|
+
'REMOTE_ADDR' => '110.160.154.44')
|
11
|
+
@mobile = Rack::Ketai::Carrier.load(@env)
|
12
|
+
end
|
13
|
+
|
14
|
+
it 'PC向け絵文字フィルタが適用されること' do
|
15
|
+
mock_app = mock('App')
|
16
|
+
mock_app.should_receive(:call).twice do |env|
|
17
|
+
[200, { "Content-Type" => "text/html"}, ["今日は良い天気ですね[e:000]"]]
|
18
|
+
end
|
19
|
+
|
20
|
+
middleware = Rack::Ketai::Middleware.new(mock_app, {})
|
21
|
+
middleware.call(@env)[2].should == ['今日は良い天気ですね[e:000]']
|
22
|
+
|
23
|
+
middleware = Rack::Ketai::Middleware.new(mock_app, { :emoticons_path => '/path-to/emoticons' })
|
24
|
+
middleware.call(@env)[2].should == ['今日は良い天気ですね<img src="/path-to/emoticons/sun.gif" />']
|
25
|
+
end
|
26
|
+
|
27
|
+
it 'Rack::Ketai::Carrier::General がセットされること' do
|
28
|
+
@mobile.should be_is_a(Rack::Ketai::Carrier::General)
|
29
|
+
end
|
30
|
+
|
31
|
+
it '携帯端末でないこと' do
|
32
|
+
@mobile.should_not be_mobile
|
33
|
+
end
|
34
|
+
|
35
|
+
it 'スマートフォンでないこと' do
|
36
|
+
@mobile.should_not be_smartphone
|
37
|
+
end
|
38
|
+
|
39
|
+
end
|
40
|
+
|
41
|
+
end
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rack-ketai
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 21
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 2
|
9
|
-
-
|
10
|
-
version: 0.2.
|
9
|
+
- 1
|
10
|
+
version: 0.2.1
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Yuichi Takeuchi
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2010-11-
|
18
|
+
date: 2010-11-16 00:00:00 +09:00
|
19
19
|
default_executable:
|
20
20
|
dependencies:
|
21
21
|
- !ruby/object:Gem::Dependency
|
@@ -98,6 +98,7 @@ files:
|
|
98
98
|
- tools/update_speclist.rb
|
99
99
|
- vendor/datum_conv/MIT-LICENSE
|
100
100
|
- vendor/datum_conv/lib/datum_conv.rb
|
101
|
+
- spec/unit/general_spec.rb
|
101
102
|
has_rdoc: true
|
102
103
|
homepage: http://github.com/take-yu/rack-ketai
|
103
104
|
licenses: []
|
@@ -144,6 +145,7 @@ test_files:
|
|
144
145
|
- spec/unit/docomo_spec.rb
|
145
146
|
- spec/unit/display_spec.rb
|
146
147
|
- spec/unit/docomo_filter_spec.rb
|
148
|
+
- spec/unit/general_spec.rb
|
147
149
|
- spec/unit/iphone_spec.rb
|
148
150
|
- spec/unit/softbank_spec.rb
|
149
151
|
- spec/unit/carrier_spec.rb
|