What can prevent an integration test from loading instance variables?

Once I completed Michael Hartl’s tutorial, I packed my homepage in a partial and called it _social_layer.html.erb Then I inserted this partial in my new homepage and proceeded to develop my application. Therefore, an extract of application’s new homepage looks like as follows:

<div role="tabpanel" class="tab-pane active" id="social-layer">
    <%= render 'static_pages/social_layer' %>
</div>

<div role="tabpanel" class="tab-pane" id="atp-team">
    <% if @atp_tournaments.any? %>
    <ul>
        <% @atp_tournaments.each do |tournament| %>
            <li> <%= tournament.name %>: <%= tournament.category %> </li>
        <% end %>
    </ul>
    <% end %>
</div>
...

As you can see this page is divided in sections or tabs, each one containing the respective code. I inserted Michael Hartl’s tutorial in the first tab.

There are two versions for my homepage, one dedicated to freshly registered users and one for users who have completed a certain selection. I called these two pages _non_gamers_home.html.erb and _gamers_home.html.erb The code above belongs to the version of the homepage dedicated to gamers (_gamers_home.html.erb) So my home.html.erb file is made up of if/else statements and contains these two partials.

The problem is that If I run the integration test dedicated to the microposts interface (the _social_layer.html.erb partial), the test fails because all instance variables in my homepage that do not belong to the social layer partial (the first one is @atp_tournaments as you can see in the above code) result nil.

I do not understand why this test fails. All these instance variables belong to the controller that controls the home page (static_pages_controller.rb) and should be loaded by the test. If I change these variables with their explicit value in the above code the test passes.

NOTE: I did not inserted any link on ‘tournament.name’ but it keeps coming out of nowhere automatically.