# Assert\_template true when it should not be?

**URL:** <https://www.ruby-forum.com/t/assert-template-true-when-it-should-not-be/188694>\
**Category:** Rails\
**Created:** [May 16, 2010, 7:22pm UTC](https://www.ruby-forum.com/t/assert-template-true-when-it-should-not-be/188694 "2010-05-16T19:22:00Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![MichaelF](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/ecc23a/32.png) [@MichaelF](https://www.ruby-forum.com/u/MichaelF)\
**Post date:** [May 16, 2010, 7:22pm UTC](https://www.ruby-forum.com/t/assert-template-true-when-it-should-not-be/188694/1 "2010-05-16T19:22:00Z")

</div>

I have a HomeController that renders one of two templates for its  
index action based on whether or not the user is authenticated.

The template names are “index” and “authenticated\_index”.

If I assert\_template “index” when testing both use cases  
assert\_template returns true. I would not expect this as the  
templates are not the same and for authenticated users you are not  
getting the index controller but rather the atuhenticated\_index  
controller.

From a review of the docs for assert\_template am I correct in seeing  
that the code uses a string.match()? If this is true I could get many  
false positives if I only require the template rendered to “match” the  
string in my test as opposed to specifically ensure that the template  
I want is rendered.

Am I wrong in my expectations/assumptions?

–Michael
