提交 05407815 编写于 作者: J Joshua Peek

Namespace TestControllers inside their test case class

上级 db0af807
......@@ -2,9 +2,14 @@
require 'controller/fake_models'
require 'pathname'
class TestController < ActionController::Base
class RenderJSTest < ActionController::TestCase
class TestController < ActionController::Base
protect_from_forgery
def self.controller_path
'test'
end
def render_vanilla_js_hello
render :js => "alert('hello')"
end
......@@ -16,9 +21,8 @@ def greeting
def show_partial
render :partial => 'partial'
end
end
end
class RenderTest < ActionController::TestCase
tests TestController
def test_render_vanilla_js
......
......@@ -2,9 +2,14 @@
require 'controller/fake_models'
require 'pathname'
class TestController < ActionController::Base
class RenderJsonTest < ActionController::TestCase
class TestController < ActionController::Base
protect_from_forgery
def self.controller_path
'test'
end
def render_json_nil
render :json => nil
end
......@@ -28,9 +33,8 @@ def render_symbol_json
def render_json_with_render_to_string
render :json => {:hello => render_to_string(:partial => 'partial')}
end
end
end
class RenderTest < ActionController::TestCase
tests TestController
def setup
......
......@@ -2,8 +2,14 @@
require 'controller/fake_models'
require 'pathname'
class TestController < ActionController::Base
class RenderOtherTest < ActionController::TestCase
class TestController < ActionController::Base
protect_from_forgery
def self.controller_path
'test'
end
layout :determine_layout
module RenderTestHelper
......@@ -103,7 +109,7 @@ def render_alternate_default
end
end
private
private
def default_render
if @alternate_default_render
@alternate_default_render.call
......@@ -132,9 +138,8 @@ def determine_layout
(request.xhr? ? 'layouts/xhr' : 'layouts/standard')
end
end
end
end
class RenderTest < ActionController::TestCase
tests TestController
def setup
......@@ -153,7 +158,7 @@ def test_enum_rjs_test
$$(".product").each(function(value, index) {
new Effect.Highlight(element,{});
new Effect.Highlight(value,{});
Sortable.create(value, {onUpdate:function(){new Ajax.Request('/test/order', {asynchronous:true, evalScripts:true, parameters:Sortable.serialize(value) + '&authenticity_token=' + encodeURIComponent('asdf')})}});
Sortable.create(value, {onUpdate:function(){new Ajax.Request('/render_other_test/test/order', {asynchronous:true, evalScripts:true, parameters:Sortable.serialize(value) + '&authenticity_token=' + encodeURIComponent('asdf')})}});
new Draggable(value, {});
});
}.gsub(/^ /, '').strip
......
......@@ -2,9 +2,14 @@
require 'controller/fake_models'
require 'pathname'
class TestController < ActionController::Base
class RenderXmlTest < ActionController::TestCase
class TestController < ActionController::Base
protect_from_forgery
def self.controller_path
'test'
end
def render_with_location
render :xml => "<hello/>", :location => "http://example.com", :status => 201
end
......@@ -30,9 +35,8 @@ def formatted_xml_erb
def render_xml_with_custom_content_type
render :xml => "<blah/>", :content_type => "application/atomsvc+xml"
end
end
end
class RenderTest < ActionController::TestCase
tests TestController
def setup
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册