A Rails view anti-pattern is that they very quickly turn into a nasty tangle of conditional html blocks.


<code class="ruby">
<% if logged_in? && @user == current_user %>

Simple example, but what is the intention of that code? Why are you really checking for? Give that state a name.

Change that to:

<code class="ruby">
def viewing_own_profile(user)
  logged_in? && user == current_user

<% if viewing_own_profile(@user) %>

Now you can test that helper method without resorting to rendering a view and parsing it to check if elements exist, the state you care about is named and the intention is clear.