I am needing to stub the response of a current_user method in an Rspec/capybara request spec. The method is defined in ApplicationController and is
current_user
ApplicationController
For Rspec 3+ the new api is:
For a controller test, nice and short:
allow(controller).to receive(:current_user).and_return(@user)
Or for all instances of ApplicationController:
allow_any_instance_of(ApplicationController).to receive(:current_user).and_return(@user)