require 'rails_helper' RSpec.describe 'Dashboard de Operações', type: :request do it 'redireciona usuário não autenticado para o login' do get operacoes_dashboard_path expect(response).to redirect_to(new_user_session_path) end it 'bloqueia motorista (Pundit redireciona para a raiz)' do sign_in create(:motorista) get operacoes_dashboard_path expect(response).to redirect_to(root_path) end it 'permite operador (renderiza a página)' do sign_in create(:operador) get operacoes_dashboard_path expect(response).to have_http_status(:ok) end it 'permite gerente' do sign_in create(:gerente) get operacoes_dashboard_path(modo: 'global') expect(response).to have_http_status(:ok) end end