aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/test/controller/mime_responds_test.rb
diff options
context:
space:
mode:
authorJosé Valim <jose.valim@gmail.com>2009-07-28 21:29:29 +0200
committerYehuda Katz <wycats@gmail.com>2009-07-29 12:06:02 -0700
commit3e8ba616efdd453dcfdd8fba78ed35fc3c1885de (patch)
tree9cf3530db032879cadb93cd9ed2f51fff6afab27 /actionpack/test/controller/mime_responds_test.rb
parent3f445b316d34a49a8b6f27bde72979828baefaa8 (diff)
downloadrails-3e8ba616efdd453dcfdd8fba78ed35fc3c1885de.tar.gz
rails-3e8ba616efdd453dcfdd8fba78ed35fc3c1885de.tar.bz2
rails-3e8ba616efdd453dcfdd8fba78ed35fc3c1885de.zip
Refactor even more Responder. Move mime negotiation to request and added respond_to class method.
Signed-off-by: Yehuda Katz <wycats@gmail.com>
Diffstat (limited to 'actionpack/test/controller/mime_responds_test.rb')
-rw-r--r--actionpack/test/controller/mime_responds_test.rb22
1 files changed, 12 insertions, 10 deletions
diff --git a/actionpack/test/controller/mime_responds_test.rb b/actionpack/test/controller/mime_responds_test.rb
index bee327998b..f2c20417f8 100644
--- a/actionpack/test/controller/mime_responds_test.rb
+++ b/actionpack/test/controller/mime_responds_test.rb
@@ -86,6 +86,7 @@ class RespondToController < ActionController::Base
type.mobile { render :text => "Mobile" }
end
ensure
+ Mime::SET.delete(:mobile)
Mime.module_eval { remove_const :MOBILE if const_defined?(:MOBILE) }
end
@@ -98,6 +99,7 @@ class RespondToController < ActionController::Base
end
ensure
+ Mime::SET.delete(:mobile)
Mime.module_eval { remove_const :MOBILE if const_defined?(:MOBILE) }
end
@@ -132,6 +134,7 @@ class RespondToController < ActionController::Base
end
ensure
+ Mime::SET.delete(:iphone)
Mime.module_eval { remove_const :IPHONE if const_defined?(:IPHONE) }
end
@@ -145,6 +148,7 @@ class RespondToController < ActionController::Base
end
ensure
+ Mime::SET.delete(:iphone)
Mime.module_eval { remove_const :IPHONE if const_defined?(:IPHONE) }
end
@@ -467,7 +471,13 @@ class MimeControllerTest < ActionController::TestCase
end
end
+class ClassRespondToController < ActionController::Base
+
+end
+
class AbstractPostController < ActionController::Base
+ respond_to :html, :iphone
+
self.view_paths = File.dirname(__FILE__) + "/../fixtures/post_test/"
end
@@ -476,10 +486,7 @@ class PostController < AbstractPostController
around_filter :with_iphone
def index
- respond_to do |type|
- type.html
- type.iphone
- end
+ respond_to # It will use formats declared above
end
protected
@@ -489,17 +496,12 @@ protected
request.format = "iphone" if request.env["HTTP_ACCEPT"] == "text/iphone"
yield
ensure
+ Mime::SET.delete(:iphone)
Mime.module_eval { remove_const :IPHONE if const_defined?(:IPHONE) }
end
end
class SuperPostController < PostController
- def index
- respond_to do |type|
- type.html
- type.iphone
- end
- end
end
class MimeControllerLayoutsTest < ActionController::TestCase