Rspec 为什么在水豚测试中销毁所有用户后我可以访问授权页面?

Rspec 为什么在水豚测试中销毁所有用户后我可以访问授权页面?,rspec,devise,capybara,ruby-on-rails-6,Rspec,Devise,Capybara,Ruby On Rails 6,我有以下测试: RSpec.describe 'Users', type: :system do before do sign_in create(:admin_user) create_list(:user, 10) end describe 'GET /index' do context 'with no users' do it 'shows 0 users in the table' do User.destroy_all

我有以下测试:

RSpec.describe 'Users', type: :system do
  before do
    sign_in create(:admin_user)
    create_list(:user, 10)
  end

  describe 'GET /index' do
    context 'with no users' do
      it 'shows 0 users in the table' do
        User.destroy_all
        visit users_path

        expect(page).to have_current_path(users_path)
        expect(page).to have_xpath '//tbody/tr', count: 0
      end
    end
  end
end
users\u path
仅对授权用户可用(我已经验证过),因此我希望在销毁所有用户后返回登录页面,因为即使登录的用户也已被删除,但我的测试成功通过。我知道默认的Capybara驱动程序不支持js,但我认为这与我的问题无关

我正在使用
designe
进行身份验证过程,并设置
RSpec
以使用
IntegrationHelpers

任何解决这个问题的线索都将不胜感激