aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/test/abstract_controller/layouts_test.rb
diff options
context:
space:
mode:
authorYehuda Katz + Carl Lerche <ykatz+clerche@engineyard.com>2009-06-08 16:14:38 -0700
committerYehuda Katz + Carl Lerche <ykatz+clerche@engineyard.com>2009-06-08 16:15:14 -0700
commit38b608ecab2441cd0c4e75bc08bdf57fcf85dd71 (patch)
treeae901461df0ebe6b065b89a5db201d08fd5dda92 /actionpack/test/abstract_controller/layouts_test.rb
parenta470bb36128cfdddd888492b7ac972ee582f6acb (diff)
downloadrails-38b608ecab2441cd0c4e75bc08bdf57fcf85dd71.tar.gz
rails-38b608ecab2441cd0c4e75bc08bdf57fcf85dd71.tar.bz2
rails-38b608ecab2441cd0c4e75bc08bdf57fcf85dd71.zip
Writing comments to AbstractController
Diffstat (limited to 'actionpack/test/abstract_controller/layouts_test.rb')
-rw-r--r--actionpack/test/abstract_controller/layouts_test.rb30
1 files changed, 15 insertions, 15 deletions
diff --git a/actionpack/test/abstract_controller/layouts_test.rb b/actionpack/test/abstract_controller/layouts_test.rb
index d3440c3de0..4b66f063f3 100644
--- a/actionpack/test/abstract_controller/layouts_test.rb
+++ b/actionpack/test/abstract_controller/layouts_test.rb
@@ -142,7 +142,7 @@ module AbstractControllerTests
end
# TODO Move to bootloader
- AbstractController::Base.subclasses.each do |klass|
+ AbstractController::Base.descendants.each do |klass|
klass = klass.constantize
next unless klass < AbstractController::Layouts
klass.class_eval do
@@ -152,70 +152,70 @@ module AbstractControllerTests
class TestBase < ActiveSupport::TestCase
test "when no layout is specified, and no default is available, render without a layout" do
- result = Blank.process(:index)
+ result = Blank.new.process(:index)
assert_equal "Hello blank!", result.response_body
end
test "when layout is specified as a string, render with that layout" do
- result = WithString.process(:index)
+ result = WithString.new.process(:index)
assert_equal "With String Hello string!", result.response_body
end
test "when layout is specified as a string, but the layout is missing, raise an exception" do
- assert_raises(ActionView::MissingTemplate) { WithMissingLayout.process(:index) }
+ assert_raises(ActionView::MissingTemplate) { WithMissingLayout.new.process(:index) }
end
test "when layout is specified as false, do not use a layout" do
- result = WithFalseLayout.process(:index)
+ result = WithFalseLayout.new.process(:index)
assert_equal "Hello false!", result.response_body
end
test "when layout is specified as nil, do not use a layout" do
- result = WithNilLayout.process(:index)
+ result = WithNilLayout.new.process(:index)
assert_equal "Hello nil!", result.response_body
end
test "when layout is specified as a symbol, call the requested method and use the layout returned" do
- result = WithSymbol.process(:index)
+ result = WithSymbol.new.process(:index)
assert_equal "OMGHI2U Hello symbol!", result.response_body
end
test "when layout is specified as a symbol and the method returns nil, don't use a layout" do
- result = WithSymbolReturningNil.process(:index)
+ result = WithSymbolReturningNil.new.process(:index)
assert_equal "Hello nilz!", result.response_body
end
test "when the layout is specified as a symbol and the method doesn't exist, raise an exception" do
- assert_raises(NoMethodError, /:nilz/) { WithSymbolAndNoMethod.process(:index) }
+ assert_raises(NoMethodError, /:nilz/) { WithSymbolAndNoMethod.new.process(:index) }
end
test "when the layout is specified as a symbol and the method returns something besides a string/false/nil, raise an exception" do
- assert_raises(ArgumentError) { WithSymbolReturningObj.process(:index) }
+ assert_raises(ArgumentError) { WithSymbolReturningObj.new.process(:index) }
end
test "when a child controller does not have a layout, use the parent controller layout" do
- result = WithStringChild.process(:index)
+ result = WithStringChild.new.process(:index)
assert_equal "With String Hello string!", result.response_body
end
test "when a child controller has specified a layout, use that layout and not the parent controller layout" do
- result = WithStringOverriddenChild.process(:index)
+ result = WithStringOverriddenChild.new.process(:index)
assert_equal "With Override Hello string!", result.response_body
end
test "when a child controller has an implied layout, use that layout and not the parent controller layout" do
- result = WithStringImpliedChild.process(:index)
+ result = WithStringImpliedChild.new.process(:index)
assert_equal "With Implied Hello string!", result.response_body
end
test "when a child controller specifies layout nil, do not use the parent layout" do
- result = WithNilChild.process(:index)
+ result = WithNilChild.new.process(:index)
assert_equal "Hello string!", result.response_body
end
test "when a grandchild has no layout specified, the child has an implied layout, and the " \
"parent has specified a layout, use the child controller layout" do
- result = WithChildOfImplied.process(:index)
+ result = WithChildOfImplied.new.process(:index)
assert_equal "With Implied Hello string!", result.response_body
end