blob: 6236acac3ab8a3f530f37542889835c1edac70c8 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
|
# frozen_string_literal: true
require 'spec_helper'
RSpec.describe 'well-known URLs', feature_category: :shared do
describe '/.well-known/change-password', feature_category: :system_access do
it 'redirects to edit profile password path' do
get('/.well-known/change-password')
expect(response).to redirect_to(edit_user_settings_password_path)
end
end
describe '/.well-known/security.txt', feature_category: :compliance_management do
let(:action) { get('/.well-known/security.txt') }
context 'for an authenticated user' do
before do
sign_in(create(:user))
end
it 'renders when a security txt is configured' do
stub_application_setting security_txt_content: 'HELLO'
action
expect(response.body).to eq('HELLO')
end
it 'returns a 404 when a security txt is blank' do
stub_application_setting security_txt_content: ''
action
expect(response).to have_gitlab_http_status(:not_found)
end
it 'returns a 404 when a security txt is nil' do
stub_application_setting security_txt_content: nil
action
expect(response).to have_gitlab_http_status(:not_found)
end
end
context 'for an unauthenticated user' do
it 'renders when a security txt is configured' do
stub_application_setting security_txt_content: 'HELLO'
action
expect(response.body).to eq('HELLO')
end
it 'redirects to sign in' do
stub_application_setting security_txt_content: ''
action
expect(response).to redirect_to(new_user_session_path)
end
end
end
end
|