I had the same problem, I have solved it by declaring all my variables as attributes inside the before
block:
describe 'index' before(:all) do @company = FactoryGirl.create(:company) @user = FactoryGirl.create(:user, company: @company) sign_in @user visit products_path end ... end
Now you can use @user
and @company
inside your tests, and you shouldn't have any warnings.