Wrong use of .t method in Rails template such
<%= (user.score).t(:context => 'foo') %>
Causes an error
undefined method `t' for 46:Fixnum
The method was called on number.
Now the question is how can this situation can be tested? Where the test code should live, so all the templates will be tested before rendering?
It depends on your choice of testing framework. With the Test::Unit stuff that comes with rails your controller and integration tests render views and so should catch this sort of error. Other forms of integration testing, such as cucumber should also pick up such things.
If you use rspec then you can write view specs: specs that test view rendering in isolation.
Lastly if you find yourself with lots of logic in your views that you want to test, you’re probably better off extracting that logic into a helper and writing unit tests/specs for that helper.