For RSpec 3+
spec/rails_helper.rb
RSpec.configure do |config|
config.include AuthHelpers
end
spec/support/auth_helpers.rb
module AuthHelpers
def sign_in(account)
allow(@controller).to receive(:authenticate_account!).and_return(true)
allow(@controller).to receive(:current_account).and_return(account)
end
end
For RSpec 3+
spec/rails_helper.rbspec/support/auth_helpers.rb