To access an instance variable @foo
in an rspect test you reference it with assigns(:foo)
expect(assigns(:user_notes)).to eq [note]
You're also missing the call to the action. It should be...
get :index
expect(assigns(:user_notes)).to eq [note]
Lastly, the let(:note) { build(:user_note) }
is lazy and doesn't execute until the variable is referenced... which is only AFTER the get :index, and build won't save to the database in any case, so change it to ...
let!(:note) { create(:user_note) }