diff --git a/spec/requests/authentication_spec.rb b/spec/requests/authentication_spec.rb index 8aebd28a..eab3f9a0 100644 --- a/spec/requests/authentication_spec.rb +++ b/spec/requests/authentication_spec.rb @@ -6,7 +6,6 @@ RSpec.describe 'Authentication', type: :request do let(:user) { create(:user, password: 'password123') } before do - # Stub GitHub API to avoid external dependencies stub_request(:get, "https://api.github.com/repos/Freika/dawarich/tags") .with(headers: { 'Accept'=>'*/*', 'Accept-Encoding'=>/.*/, 'Host'=>'api.github.com', 'User-Agent'=>/.*/}) @@ -26,10 +25,6 @@ RSpec.describe 'Authentication', type: :request do end end - # The self-hosted registration tests are already covered by system tests - # And it seems the route doesn't exist in the test environment - # Focus on the core authentication functionality in request specs - describe 'Account Management' do it 'prevents account update without current password' do sign_in user @@ -41,7 +36,6 @@ RSpec.describe 'Authentication', type: :request do } } - # Just check it's not a successful response expect(response).not_to be_successful expect(user.reload.email).not_to eq('updated@example.com') end @@ -56,7 +50,6 @@ RSpec.describe 'Authentication', type: :request do } } - # Devise redirects to root_path by default, not map_path expect(response).to redirect_to(root_path) expect(user.reload.email).to eq('updated@example.com') end diff --git a/spec/system/authentication_spec.rb b/spec/system/authentication_spec.rb index f8d49190..42786fae 100644 --- a/spec/system/authentication_spec.rb +++ b/spec/system/authentication_spec.rb @@ -6,7 +6,6 @@ RSpec.describe 'Authentication UI', type: :system do let(:user) { create(:user, password: 'password123') } before do - # Stub the GitHub API call to avoid external dependencies stub_request(:any, 'https://api.github.com/repos/Freika/dawarich/tags') .to_return(status: 200, body: '[{"name": "1.0.0"}]', headers: {}) @@ -17,38 +16,29 @@ RSpec.describe 'Authentication UI', type: :system do ActionMailer::Base.deliveries.clear end - # We'll keep only UI-focused tests that actually need to test visual elements - describe 'Account UI' do it 'shows the user email in the UI when signed in' do sign_in_user(user) - expect(page).to have_current_path(map_path) - # Verify user dropdown is present (indicates user is signed in) + expect(page).to have_current_path(map_path) expect(page).to have_css('summary', text: user.email) end - - end describe 'Self-hosted UI' do context 'when self-hosted mode is enabled' do before do - # Mock DawarichSettings.self_hosted? to be true to disable registration allow(DawarichSettings).to receive(:self_hosted?).and_return(true) stub_const('SELF_HOSTED', true) end it 'does not show registration links in the login UI' do visit new_user_session_path + expect(page).not_to have_link('Register') expect(page).not_to have_link('Sign up') expect(page).not_to have_content('Register a new account') end end end - - - - end