Backport #5808

df36c5f - Fix assert_template assertion with :layout option
4bd05a7 - Fix assert_template :layout => nil assertion
0d19a08 - Improve assert_template layout checking
Merge pull request #9899 from macksmind/backport_5808

Backport #5808