|
70 | 70 | end |
71 | 71 | end |
72 | 72 |
|
| 73 | + describe('#show_identifier') do |
| 74 | + let!(:remixed_project) do |
| 75 | + create(:project, remixed_from_id: original_project.id, user_id: authenticated_user.id) |
| 76 | + end |
| 77 | + |
| 78 | + it 'returns success response' do |
| 79 | + get("/api/projects/#{original_project.identifier}/remix/identifier", headers:) |
| 80 | + expect(response).to have_http_status(:ok) |
| 81 | + end |
| 82 | + |
| 83 | + it 'returns the project identifier' do |
| 84 | + get("/api/projects/#{original_project.identifier}/remix/identifier", headers:) |
| 85 | + expect(response.parsed_body['identifier']).to eq(remixed_project.identifier) |
| 86 | + end |
| 87 | + |
| 88 | + it 'returns 404 response if invalid project' do |
| 89 | + get('/api/projects/no-such-project/remix/identifier', headers:) |
| 90 | + expect(response).to have_http_status(:not_found) |
| 91 | + end |
| 92 | + |
| 93 | + it 'returns 404 if no remixed project for user' do |
| 94 | + another_user = create(:owner, school:) |
| 95 | + authenticated_in_hydra_as(another_user) |
| 96 | + |
| 97 | + get("/api/projects/#{original_project.identifier}/remix/identifier", headers:) |
| 98 | + expect(response).to have_http_status(:not_found) |
| 99 | + end |
| 100 | + end |
| 101 | + |
73 | 102 | describe '#create' do |
74 | 103 | it 'returns success response' do |
75 | 104 | post("/api/projects/#{original_project.identifier}/remix", params: { project: project_params }, headers:) |
|
116 | 145 | end |
117 | 146 | end |
118 | 147 |
|
| 148 | + describe '#show_identifier' do |
| 149 | + it 'returns unauthorized' do |
| 150 | + get "/api/projects/#{original_project.identifier}/remix/identifier" |
| 151 | + expect(response).to have_http_status(:unauthorized) |
| 152 | + end |
| 153 | + end |
| 154 | + |
119 | 155 | describe '#create' do |
120 | 156 | it 'returns unauthorized' do |
121 | 157 | post "/api/projects/#{original_project.identifier}/remix" |
|
0 commit comments