title: RSpec assigns(:items).should eq([item]) returns nil
body: <p>I'm very new to RSpec, and obviously doing something wrong. </p>
  
  <p>Have basic controller with Index action:</p>
  
  <pre><code>class TransactionsController &lt; ApplicationController
  
    before_filter :authenticate_user!
    def index
      @transactions = current_user.transactions
      respond_to do |format|
        format.html { render layout: "items" } # index.html.erb
        format.json { render json: @transactions }
      end
    end
  end
  </code></pre>
  
  <p>And have a default RSpec test for Index action.</p>
  
  <pre><code>require 'spec_helper'
  
  describe TransactionsController do
     describe "GET index" do
       it "assigns all transactions as @transactions" do
         transaction = FactoryGirl.create(:transaction)
         get :index
         assigns(:transactions).should eq([transaction])
       end
     end
  end
  </code></pre>
  
  <p>So all works, except that the line <code>assigns(:transactions).should eq([transaction])</code> returns nil, so I get this error:</p>
  
  <pre><code>Failure/Error: assigns(:transactions).should eq([transaction])
  
     expected: [#&lt;Transaction id: 1, user_id: 1, text: "some transaction", date: "2013-02-02", money: #&lt;BigDecimal:b8a8e90,'0.999E1',18(18)&gt;, created_at: "2013-02-02 09:17:42", updated_at: "2013-02-02 09:17:42"&gt;]
          got: nil
  
     (compared using ==)
   # ./spec/controllers/transactions_controller_spec.rb:17:in `block (3 levels) in &lt;top (required)&gt;'
  </code></pre>
  
  <p>Would appreciate any tips, as I've spent all day on this.</p>