|
4 | 4 |
|
5 | 5 | RSpec.describe 'Destroying a public project', type: :request do |
6 | 6 | let(:destroyer) { build(:experience_cs_admin_user) } |
7 | | - let(:project) { create(:project, locale: 'en') } |
| 7 | + let(:project) { create(:project, locale: 'en', project_type: Project::Types::SCRATCH) } |
8 | 8 | let(:headers) { { Authorization: UserProfileMock::TOKEN } } |
9 | 9 |
|
10 | 10 | before do |
11 | 11 | authenticated_in_hydra_as(destroyer) |
12 | 12 | end |
13 | 13 |
|
14 | 14 | it 'responds 200 OK' do |
15 | | - delete("/api/public_projects/#{project.identifier}", headers:) |
| 15 | + delete("/api/public_projects/#{project.identifier}?project_type=scratch", headers:) |
16 | 16 | expect(response).to have_http_status(:success) |
17 | 17 | end |
18 | 18 |
|
19 | 19 | it 'deletes the project' do |
20 | | - delete("/api/public_projects/#{project.identifier}", headers:) |
| 20 | + delete("/api/public_projects/#{project.identifier}?project_type=scratch", headers:) |
21 | 21 | expect(Project).not_to exist(identifier: project.identifier) |
22 | 22 | end |
23 | 23 |
|
24 | 24 | it 'responds 401 Unauthorized when no token is given' do |
25 | | - delete("/api/public_projects/#{project.identifier}") |
| 25 | + delete("/api/public_projects/#{project.identifier}?project_type=scratch") |
26 | 26 | expect(response).to have_http_status(:unauthorized) |
27 | 27 | end |
28 | 28 |
|
29 | 29 | context 'when destroyer is not an experience-cs admin' do |
30 | 30 | let(:destroyer) { build(:user) } |
31 | 31 |
|
32 | 32 | it 'responds 403 Forbidden' do |
33 | | - delete("/api/public_projects/#{project.identifier}", headers:) |
| 33 | + delete("/api/public_projects/#{project.identifier}?project_type=scratch", headers:) |
34 | 34 | expect(response).to have_http_status(:forbidden) |
35 | 35 | end |
36 | 36 | end |
37 | 37 |
|
38 | 38 | it 'responds 404 Not Found when project is not found' do |
39 | | - delete('/api/public_projects/another-identifier', headers:) |
| 39 | + delete('/api/public_projects/another-identifier?project_type=scratch', headers:) |
40 | 40 | expect(response).to have_http_status(:not_found) |
41 | 41 | end |
42 | 42 | end |
0 commit comments