jpmobile 0.0.8 → 0.1.0.pre

Sign up to get free protection for your applications and to get access to all the features.
Files changed (132) hide show
  1. data/.gitignore +0 -3
  2. data/{spec/spec.opts → .rspec} +1 -2
  3. data/README.rdoc +122 -128
  4. data/Rakefile +23 -101
  5. data/VERSION.yml +4 -3
  6. data/jpmobile.gemspec +130 -182
  7. data/lib/jpmobile.rb +37 -24
  8. data/lib/jpmobile/docomo_guid.rb +2 -1
  9. data/lib/jpmobile/email.rb +3 -4
  10. data/lib/jpmobile/emoticon.rb +2 -6
  11. data/lib/jpmobile/encoding.rb +29 -0
  12. data/lib/jpmobile/filter.rb +42 -134
  13. data/lib/jpmobile/helpers.rb +5 -18
  14. data/lib/jpmobile/hook_action_controller.rb +24 -16
  15. data/lib/jpmobile/hook_action_view.rb +28 -89
  16. data/lib/jpmobile/mobile/abstract_mobile.rb +21 -4
  17. data/lib/jpmobile/mobile/android.rb +10 -0
  18. data/lib/jpmobile/mobile/au.rb +28 -3
  19. data/lib/jpmobile/mobile/ddipocket.rb +12 -0
  20. data/lib/jpmobile/mobile/display.rb +29 -26
  21. data/lib/jpmobile/mobile/docomo.rb +38 -12
  22. data/lib/jpmobile/mobile/iphone.rb +26 -0
  23. data/lib/jpmobile/mobile/smart_phone.rb +21 -0
  24. data/lib/jpmobile/mobile/softbank.rb +16 -41
  25. data/lib/jpmobile/mobile/vodafone.rb +17 -0
  26. data/lib/jpmobile/mobile/willcom.rb +1 -10
  27. data/lib/jpmobile/mobile/windows_phone.rb +10 -0
  28. data/lib/jpmobile/position.rb +4 -3
  29. data/lib/jpmobile/rack.rb +43 -0
  30. data/lib/jpmobile/rack/filter.rb +51 -0
  31. data/lib/jpmobile/rack/mobile_carrier.rb +33 -0
  32. data/lib/jpmobile/rack/params_filter.rb +47 -0
  33. data/lib/jpmobile/rails.rb +22 -0
  34. data/lib/jpmobile/request_with_mobile.rb +8 -12
  35. data/lib/jpmobile/trans_sid.rb +44 -26
  36. data/lib/jpmobile/util.rb +68 -0
  37. data/{tasks → lib/tasks}/jpmobile_tasks.rake +32 -13
  38. data/spec/rack/jpmobile/android_spec.rb +20 -0
  39. data/spec/rack/jpmobile/au_spec.rb +206 -0
  40. data/spec/rack/jpmobile/docomo_spec.rb +237 -0
  41. data/spec/rack/jpmobile/emoticon_spec.rb +215 -0
  42. data/spec/rack/jpmobile/filter_spec.rb +181 -0
  43. data/spec/rack/jpmobile/iphone_spec.rb +32 -0
  44. data/spec/rack/jpmobile/mobile_by_ua_spec.rb +39 -0
  45. data/spec/rack/jpmobile/params_filter_spec.rb +193 -0
  46. data/spec/rack/jpmobile/softbank_spec.rb +123 -0
  47. data/spec/rack/jpmobile/willcom_spec.rb +67 -0
  48. data/spec/rack/jpmobile/windows_phone.rb +20 -0
  49. data/spec/rack_helper.rb +86 -0
  50. data/spec/spec_helper.rb +3 -2
  51. data/spec/unit/detect_by_email_spec.rb +21 -27
  52. data/spec/unit/is_carrier_spec.rb +56 -84
  53. data/spec/unit/spec_helper.rb +1 -2
  54. data/spec/unit/util_spec.rb +2 -2
  55. data/spec/unit/valid_ip_spec.rb +43 -52
  56. data/test/legacy/autoload_test.rb +1 -3
  57. data/test/legacy/emoticon_test.rb +5 -6
  58. data/test/legacy/helper.rb +0 -71
  59. data/test/rails/overrides/.rspec +5 -0
  60. data/test/rails/overrides/Gemfile +32 -0
  61. data/test/rails/overrides/app/controllers/docomo_guid_always_controller.rb +3 -0
  62. data/test/rails/overrides/app/controllers/docomo_guid_base_controller.rb +5 -0
  63. data/test/rails/overrides/app/controllers/docomo_guid_docomo_controller.rb +3 -0
  64. data/test/rails/overrides/app/controllers/filter_controller.rb +0 -34
  65. data/test/rails/overrides/app/controllers/filter_controller_base.rb +19 -0
  66. data/test/rails/overrides/app/controllers/hankaku_filter_controller.rb +3 -0
  67. data/test/rails/overrides/app/controllers/links_controller.rb +28 -0
  68. data/test/rails/overrides/app/controllers/mobile_spec_controller.rb +1 -1
  69. data/test/rails/overrides/app/controllers/template_path_controller.rb +3 -0
  70. data/test/rails/overrides/app/controllers/trans_sid_always_and_session_off_controller.rb +4 -0
  71. data/test/rails/overrides/app/controllers/trans_sid_always_controller.rb +3 -0
  72. data/test/rails/overrides/app/controllers/trans_sid_base_controller.rb +18 -0
  73. data/test/rails/overrides/app/controllers/trans_sid_mobile_controller.rb +3 -0
  74. data/test/rails/overrides/app/controllers/trans_sid_none_controller.rb +3 -0
  75. data/test/rails/overrides/app/views/links/au_gps.html.erb +1 -0
  76. data/test/rails/overrides/app/views/links/au_location.html.erb +1 -0
  77. data/test/rails/overrides/app/views/links/docomo_foma_gps.html.erb +1 -0
  78. data/test/rails/overrides/app/views/links/docomo_openiarea.html.erb +1 -0
  79. data/test/rails/overrides/app/views/links/docomo_utn.html.erb +1 -0
  80. data/test/rails/overrides/app/views/links/link.html.erb +1 -0
  81. data/test/rails/overrides/app/views/links/show_all.html.erb +1 -0
  82. data/test/rails/overrides/app/views/links/softbank_location.html.erb +1 -0
  83. data/test/rails/overrides/app/views/links/willcom_location.html.erb +1 -0
  84. data/test/rails/overrides/app/views/template_path/_partial_smart_phone.html.erb +1 -0
  85. data/test/rails/overrides/app/views/template_path/_partial_smart_phone_iphone.html.erb +1 -0
  86. data/test/rails/overrides/app/views/template_path/index_smart_phone.html.erb +1 -0
  87. data/test/rails/overrides/app/views/template_path/index_smart_phone_iphone.html.erb +1 -0
  88. data/test/rails/overrides/app/views/template_path/show_mobile.html.erb +1 -0
  89. data/test/rails/overrides/app/views/template_path/show_mobile_docomo.html.erb +1 -0
  90. data/test/rails/overrides/autotest/discover.rb +2 -0
  91. data/test/rails/overrides/config/initializers/jpmobile_generator.rb +1 -0
  92. data/test/rails/overrides/config/routes.rb +58 -0
  93. data/test/rails/overrides/db/migrate/001_add_sessions_table.rb +16 -0
  94. data/test/rails/overrides/spec/helpers/helpers_spec.rb +2 -2
  95. data/test/rails/overrides/spec/{controllers → requests}/docomo_guid_spec.rb +37 -14
  96. data/test/rails/overrides/spec/{controllers → requests}/docomo_spec.rb +11 -8
  97. data/test/rails/overrides/spec/{controllers → requests}/emobile_spec.rb +24 -8
  98. data/test/rails/overrides/spec/requests/filter_spec.rb +171 -0
  99. data/test/rails/overrides/spec/requests/helpers_spec.rb +187 -0
  100. data/test/rails/overrides/spec/requests/pc_spec.rb +22 -0
  101. data/test/rails/overrides/spec/requests/softbank_emulator_spec.rb +21 -0
  102. data/test/rails/overrides/spec/requests/template_path_spec.rb +234 -0
  103. data/test/rails/overrides/spec/requests/trans_sid_spec.rb +142 -0
  104. data/test/rails/overrides/spec/spec_helper.rb +17 -48
  105. data/test/sinatra/guestbook.rb +40 -0
  106. data/test/sinatra/test/filter_test.rb +39 -0
  107. metadata +185 -312
  108. data/lib/jpmobile/hook_request.rb +0 -5
  109. data/lib/jpmobile/rack/auth.rb +0 -55
  110. data/lib/jpmobile/rack/combined_logger.rb +0 -54
  111. data/lib/jpmobile/rack/request.rb +0 -7
  112. data/lib/jpmobile/rack/trans_sid.rb +0 -14
  113. data/lib/jpmobile/version.rb +0 -9
  114. data/spec/unit/detect_by_ua_spec.rb +0 -40
  115. data/test/legacy/au_test.rb +0 -173
  116. data/test/legacy/docomo_test.rb +0 -187
  117. data/test/legacy/emoticon_functional_test.rb +0 -195
  118. data/test/legacy/filter_test.rb +0 -34
  119. data/test/legacy/helpers_test.rb +0 -217
  120. data/test/legacy/softbank_test.rb +0 -183
  121. data/test/legacy/willcom_test.rb +0 -56
  122. data/test/rails/2.3.2/spec/controllers/trans_sid_spec.rb +0 -99
  123. data/test/rails/overrides/app/controllers/docomo_guid_controller.rb +0 -13
  124. data/test/rails/overrides/app/controllers/trans_sid_controller.rb +0 -28
  125. data/test/rails/overrides/lib/tasks/rspec.rake +0 -165
  126. data/test/rails/overrides/spec/controllers/filter_spec.rb +0 -159
  127. data/test/rails/overrides/spec/controllers/pc_spec.rb +0 -13
  128. data/test/rails/overrides/spec/controllers/softbank_emulator_spec.rb +0 -42
  129. data/test/rails/overrides/spec/controllers/template_path_spec.rb +0 -117
  130. data/test/rails/overrides/spec/controllers/trans_sid_spec.rb +0 -117
  131. data/test/rails/overrides/spec/rspec.rake +0 -165
  132. data/test/rails/overrides/spec/spec.opts +0 -4
@@ -0,0 +1,5 @@
1
+ --colour
2
+ --format
3
+ progress
4
+ mtime
5
+ -b
@@ -0,0 +1,32 @@
1
+ source 'http://rubygems.org'
2
+
3
+ gem 'rails', '3.0.0.beta4'
4
+
5
+ # Bundle edge Rails instead:
6
+ # gem 'rails', :git => 'git://github.com/rails/rails.git'
7
+
8
+ gem 'sqlite3-ruby', :require => 'sqlite3'
9
+
10
+ gem 'geokit'
11
+ gem 'hpricot'
12
+
13
+ # Use unicorn as the web server
14
+ # gem 'unicorn'
15
+
16
+ # Deploy with Capistrano
17
+ # gem 'capistrano'
18
+
19
+ # To use debugger
20
+ # gem 'ruby-debug'
21
+
22
+ # Bundle the extra gems:
23
+ # gem 'bj'
24
+ # gem 'nokogiri', '1.4.1'
25
+ # gem 'sqlite3-ruby', :require => 'sqlite3'
26
+ # gem 'aws-s3', :require => 'aws/s3'
27
+
28
+ # Bundle gems for certain environments:
29
+ group :development, :test do
30
+ gem "rspec", "2.0.0.beta.17"
31
+ gem "rspec-rails", "2.0.0.beta.17"
32
+ end
@@ -0,0 +1,3 @@
1
+ class DocomoGuidAlwaysController < DocomoGuidBaseController
2
+ docomo_guid :always
3
+ end
@@ -0,0 +1,5 @@
1
+ class DocomoGuidBaseController < ApplicationController
2
+ def link
3
+ render :inline=>%{<%= link_to "linkto" %>}
4
+ end
5
+ end
@@ -0,0 +1,3 @@
1
+ class DocomoGuidDocomoController < DocomoGuidBaseController
2
+ docomo_guid :docomo
3
+ end
@@ -1,37 +1,3 @@
1
- # -*- coding: utf-8 -*-
2
- class FilterControllerBase < ApplicationController
3
- def abracadabra_utf8
4
- render :text => "アブラカダブラ"
5
- end
6
- def abracadabra_xhtml_utf8
7
- response.content_type = "application/xhtml+xml"
8
- render :text => "アブラカダブラ"
9
- end
10
- def index
11
- @q = params[:q]
12
- end
13
- def empty
14
- render :text => ""
15
- end
16
- def rawdata
17
- send_data "アブラカダブラ", :type => 'application/octet-stream'
18
- end
19
- end
20
-
21
1
  class FilterController < FilterControllerBase
22
2
  mobile_filter
23
3
  end
24
-
25
- class HankakuFilterController < FilterControllerBase
26
- mobile_filter :hankaku => true
27
-
28
- around_filter :freeze_response_body
29
-
30
- private
31
- def freeze_response_body
32
- yield
33
- if response.body.respond_to?(:freeze)
34
- response.body.freeze
35
- end
36
- end
37
- end
@@ -0,0 +1,19 @@
1
+ # -*- coding: utf-8 -*-
2
+ class FilterControllerBase < ApplicationController
3
+ def abracadabra_utf8
4
+ render :text => "アブラカダブラ"
5
+ end
6
+ def abracadabra_xhtml_utf8
7
+ response.content_type = "application/xhtml+xml"
8
+ render :text => "アブラカダブラ"
9
+ end
10
+ def index
11
+ @q = params[:q]
12
+ end
13
+ def empty
14
+ render :text => ""
15
+ end
16
+ def rawdata
17
+ send_data "アブラカダブラ", :type => 'application/octet-stream'
18
+ end
19
+ end
@@ -0,0 +1,3 @@
1
+ class HankakuFilterController < FilterControllerBase
2
+ mobile_filter :hankaku => true
3
+ end
@@ -0,0 +1,28 @@
1
+ class LinksController < ApplicationController
2
+ def show_all
3
+ end
4
+
5
+ def link
6
+ end
7
+
8
+ def docomo_utn
9
+ end
10
+
11
+ def docomo_openiarea
12
+ end
13
+
14
+ def docomo_foma_gps
15
+ end
16
+
17
+ def au_location
18
+ end
19
+
20
+ def au_gps
21
+ end
22
+
23
+ def softbank_location
24
+ end
25
+
26
+ def willcom_location
27
+ end
28
+ end
@@ -1,5 +1,5 @@
1
1
  class MobileSpecController < ApplicationController
2
- def hello
2
+ def index
3
3
  render :text=>"Hello, world."
4
4
  end
5
5
  end
@@ -2,5 +2,8 @@ class TemplatePathController < ApplicationController
2
2
  def index
3
3
  @q = params[:q]
4
4
  end
5
+
6
+ def show
7
+ end
5
8
  end
6
9
 
@@ -0,0 +1,4 @@
1
+ class TransSidAlwaysAndSessionOffController < TransSidBaseController
2
+ trans_sid :always
3
+ skip_before_filter :session_init
4
+ end
@@ -0,0 +1,3 @@
1
+ class TransSidAlwaysController < TransSidBaseController
2
+ trans_sid :always
3
+ end
@@ -0,0 +1,18 @@
1
+ # -*- coding: utf-8 -*-
2
+ class TransSidBaseController < ApplicationController
3
+ # 事前にセッションを作成しないと trans_sid が有効にならない
4
+ before_filter :session_init
5
+
6
+ def form
7
+ render :inline=>%{<%= form_tag do %>Hello<% end %>}
8
+ end
9
+ def link
10
+ render :inline=>%{<%= link_to "linkto" %>}
11
+ end
12
+ def redirect
13
+ redirect_to('/')
14
+ end
15
+ def session_init
16
+ session[:jpmobile] = "everyleaf"
17
+ end
18
+ end
@@ -0,0 +1,3 @@
1
+ class TransSidMobileController < TransSidBaseController
2
+ trans_sid :mobile
3
+ end
@@ -0,0 +1,3 @@
1
+ class TransSidNoneController < TransSidBaseController
2
+ trans_sid :none
3
+ end
@@ -0,0 +1 @@
1
+ <%= au_gps_link_to("STRING") -%>
@@ -0,0 +1 @@
1
+ <%= au_location_link_to("STRING") -%>
@@ -0,0 +1 @@
1
+ <%= docomo_foma_gps_link_to("STRING") -%>
@@ -0,0 +1 @@
1
+ <%= docomo_openiarea_link_to("STRING") -%>
@@ -0,0 +1 @@
1
+ <%= docomo_utn_link_to("STRING") -%>
@@ -0,0 +1 @@
1
+ <%= get_position_link_to("STRING") -%>
@@ -0,0 +1 @@
1
+ <%= get_position_link_to(:show_all => true) -%>
@@ -0,0 +1 @@
1
+ <%= softbank_location_link_to("STRING") -%>
@@ -0,0 +1 @@
1
+ <%= willcom_location_link_to("STRING") -%>
@@ -0,0 +1 @@
1
+ <h2>_partial_smart_phone.html.erb</h2>
@@ -0,0 +1 @@
1
+ <h2>_partial_smart_phone_iphone.html.erb</h2>
@@ -0,0 +1 @@
1
+ <h1>index_smart_phone.html.erb<h1>
@@ -0,0 +1 @@
1
+ <h1>index_smart_phone_iphone.html.erb<h1>
@@ -0,0 +1 @@
1
+ <h1>show_mobile.html.erb</h1>
@@ -0,0 +1 @@
1
+ <h1>show_mobile_docomo.html.erb</h1>
@@ -0,0 +1,2 @@
1
+ Autotest.add_discovery { "rails" }
2
+ Autotest.add_discovery { "rspec2" }
@@ -0,0 +1 @@
1
+ Rails.application.config.jpmobile.mobile_filter
@@ -0,0 +1,58 @@
1
+ RailsRoot::Application.routes.draw do |map|
2
+ # The priority is based upon order of creation:
3
+ # first created -> highest priority.
4
+
5
+ # Sample of regular route:
6
+ # match 'products/:id' => 'catalog#view'
7
+ # Keep in mind you can assign values other than :controller and :action
8
+
9
+ # Sample of named route:
10
+ # match 'products/:id/purchase' => 'catalog#purchase', :as => :purchase
11
+ # This route can be invoked with purchase_url(:id => product.id)
12
+
13
+ # Sample resource route (maps HTTP verbs to controller actions automatically):
14
+ # resources :products
15
+
16
+ # Sample resource route with options:
17
+ # resources :products do
18
+ # member do
19
+ # get :short
20
+ # post :toggle
21
+ # end
22
+ #
23
+ # collection do
24
+ # get :sold
25
+ # end
26
+ # end
27
+
28
+ # Sample resource route with sub-resources:
29
+ # resources :products do
30
+ # resources :comments, :sales
31
+ # resource :seller
32
+ # end
33
+
34
+ # Sample resource route with more complex sub-resources
35
+ # resources :products do
36
+ # resources :comments
37
+ # resources :sales do
38
+ # get :recent, :on => :collection
39
+ # end
40
+ # end
41
+
42
+ # Sample resource route within a namespace:
43
+ # namespace :admin do
44
+ # # Directs /admin/products/* to Admin::ProductsController
45
+ # # (app/controllers/admin/products_controller.rb)
46
+ # resources :products
47
+ # end
48
+
49
+ # You can have the root of your site routed with "root"
50
+ # just remember to delete public/index.html.
51
+ # root :to => "welcome#index"
52
+
53
+ # See how all your routes lay out with "rake routes"
54
+
55
+ # This is a legacy wild controller route that's not recommended for RESTful applications.
56
+ # Note: This route will make all actions in every controller accessible via GET requests.
57
+ match ':controller(/:action(/:id(.:format)))'
58
+ end
@@ -0,0 +1,16 @@
1
+ class AddSessionsTable < ActiveRecord::Migration
2
+ def self.up
3
+ create_table :sessions do |t|
4
+ t.string :session_id, :null => false
5
+ t.text :data
6
+ t.timestamps
7
+ end
8
+
9
+ add_index :sessions, :session_id
10
+ add_index :sessions, :updated_at
11
+ end
12
+
13
+ def self.down
14
+ drop_table :sessions
15
+ end
16
+ end
@@ -5,11 +5,11 @@ require File.dirname(__FILE__) + '/../spec_helper'
5
5
  describe Jpmobile::Helpers do
6
6
  include Jpmobile::Helpers
7
7
  it "docomo_guid_link_to が guid=ON を付けたリンクを生成すること" do
8
- docomo_guid_link_to("STRING", :controller => "MyController", :action => "myaction").should == %{<a href="/mycontroller/myaction?guid=ON">STRING</a>}
8
+ docomo_guid_link_to("STRING", :controller => "filter", :action => "rawdata").should == %{<a href="/filter/rawdata?guid=ON">STRING</a>}
9
9
  end
10
10
 
11
11
  it "softbank_location_link_to がリンク先にパラメータを含んでいても正常に動作すること" do
12
12
  # http://d.hatena.ne.jp/mizincogrammer/20090123/1232702067
13
- softbank_location_link_to("STRING", :controller => "MyController", :action => "myaction", :p => "param").should == %{<a href="location:auto?url=http://test.host/mycontroller/myaction&p=param">STRING</a>}
13
+ softbank_location_link_to("STRING", :controller => "filter", :action => "rawdata", :p => "param").should == %{<a href="location:auto?url=http://test.host/filter/rawdata&p=param">STRING</a>}
14
14
  end
15
15
  end
@@ -2,48 +2,72 @@
2
2
 
3
3
  require File.dirname(__FILE__) + '/../spec_helper'
4
4
 
5
- describe "docomo_guid が起動しないとき", :shared => true do
5
+ shared_examples_for "docomo_guid が起動しないとき" do
6
6
  it "で link_to の自動書き換えが行われない" do
7
- get :link
8
- response.body.should =~ %r{^<a href="/.+?/link">linkto</a>$}
7
+ get "/#{@controller}/link", {}, {"HTTP_USER_AGENT" => @user_agent}
8
+
9
+ response.should have_tag('a') do |a|
10
+ a.first['href'].should match(/^\/.+?\/link$/)
11
+ end
9
12
  end
10
13
  end
11
14
 
12
- describe "docomo_guid が起動するとき", :shared => true do
15
+ shared_examples_for "docomo_guid が起動するとき" do
13
16
  it "で link_to の自動書き換えが行われる" do
14
- get :link
15
- response.body.should =~ %r{^<a href="/.+?/link\?guid=ON">linkto</a>$}
17
+ get "/#{@controller}/link", {}, {"HTTP_USER_AGENT" => @user_agent}
18
+
19
+ response.should have_tag('a') do |a|
20
+ a.first['href'].should match(/^\/.+?\/link\?guid=ON$/)
21
+ end
16
22
  end
17
23
  end
18
24
 
19
25
  describe DocomoGuidBaseController, "という docomo_guid が有効になっていないコントローラ" do
20
- controller_name :docomo_guid_base
26
+ before(:each) do
27
+ @controller = "docomo_guid_base"
28
+ @user_agent = "Mozilla/5.0 (Windows; U; Windows NT 5.1; ja; rv:1.9.2.3) Gecko/20100401 Firefox/3.6.3 ( .NET CLR 3.5.30729)"
29
+ end
30
+
21
31
  it "の docomo_guid_mode は nil" do
32
+ get "/#{@controller}/link", {}, {"HTTP_USER_AGENT" => @user_agent}
33
+
22
34
  controller.docomo_guid_mode.should be_nil
23
35
  end
24
36
  it_should_behave_like "docomo_guid が起動しないとき"
25
37
  end
26
38
 
27
39
  describe DocomoGuidAlwaysController, "という docomo_guid :always が指定されているコントローラ" do
28
- controller_name :docomo_guid_always
29
- it "の trans_sid_mode は :always" do
40
+ before(:each) do
41
+ @controller = "docomo_guid_always"
42
+ @user_agent = "Mozilla/5.0 (Windows; U; Windows NT 5.1; ja; rv:1.9.2.3) Gecko/20100401 Firefox/3.6.3 ( .NET CLR 3.5.30729)"
43
+ end
44
+
45
+ it "の docomo_guid_always は :always" do
46
+ get "/#{@controller}/link", {}, {"HTTP_USER_AGENT" => @user_agent}
47
+
30
48
  controller.docomo_guid_mode.should == :always
31
49
  end
32
50
  it_should_behave_like "docomo_guid が起動するとき"
33
51
  end
34
52
 
35
53
  describe DocomoGuidDocomoController, "という docomo_guid :docomo が指定されているコントローラ" do
36
- controller_name :docomo_guid_docomo
54
+ before(:each) do
55
+ @controller = "docomo_guid_docomo"
56
+ @user_agent = "Mozilla/5.0 (Windows; U; Windows NT 5.1; ja; rv:1.9.2.3) Gecko/20100401 Firefox/3.6.3 ( .NET CLR 3.5.30729)"
57
+ end
58
+
37
59
  it "の docomo_guid_mode は :docomo" do
60
+ get "/#{@controller}/link", {}, {"HTTP_USER_AGENT" => @user_agent}
61
+
38
62
  controller.docomo_guid_mode.should == :docomo
39
63
  end
40
64
  end
41
65
 
42
66
  def describe_mobile_with_ua(user_agent, &block)
43
- describe("trans_sid :docomo が指定されているコントローラに #{user_agent} からアクセスしたとき") do
44
- controller_name :docomo_guid_docomo
67
+ describe("docomo_guid :docomo が指定されているコントローラに #{user_agent} からアクセスしたとき") do
45
68
  before do
46
- request.user_agent = user_agent
69
+ @controller = "docomo_guid_docomo"
70
+ @user_agent = user_agent
47
71
  end
48
72
  instance_eval(&block)
49
73
  end
@@ -73,7 +97,6 @@ describe_mobile_with_ua "DoCoMo/1.0/N505i/c20/TB/W20H10 (compatible; Googlebot-M
73
97
  it_should_behave_like "docomo_guid が起動しないとき"
74
98
  end
75
99
 
76
-
77
100
  describe_mobile_with_ua "DoCoMo/2.0/SO502i (compatible; Y!J-SRD/1.0; http://help.yahoo.co.jp/help/jp/search/indexing/indexing-27.html)" do
78
101
  it_should_behave_like "docomo_guid が起動しないとき"
79
102
  end