require File.join(File.dirname(__FILE__), *%w[.. test_helper])
class RenderTest < ActionView::TestCase
context "Rendering a single widget" do
setup do
@mum = mouse_mock
end
should "per default display the state content framed in a div" do
assert_equal '
squeak!<\\/div>\")", @mum.invoke(:squeak)
end
end
end
context "rendering a widget family" do
setup do
@mum = mouse_mock('mum', :snuggle) do
def snuggle; render; end
end
@mum << @kid = mouse_mock('kid')
end
should "per default render kid's content inside mums div with rendered_children" do
assert_equal '
', @mum.invoke(:snuggle)
end
should "skip kids if :render_children=>false but still provide a rendered_children hash" do
@mum.instance_eval do
def snuggle; render :render_children => false; end
end
assert_equal '
', @mum.invoke(:snuggle)
end
should_eventually "provide an ordered rendered_children hash"
end
end