Skip to content

Commit 97d257f

Browse files
committed
Ensure identifier generated when project created
I'm about to make a change to how this works and I want to be sure the change won't break anything.
1 parent 672c90e commit 97d257f

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

spec/features/project/creating_a_project_spec.rb

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,11 @@
33
require 'rails_helper'
44

55
RSpec.describe 'Creating a project', type: :request do
6+
let(:generated_identifier) { 'word1-word2-word3' }
67
let(:headers) { { Authorization: UserProfileMock::TOKEN } }
78
let(:teacher) { create(:teacher, school:) }
89
let(:school) { create(:school) }
910
let(:owner) { create(:owner, school:) }
10-
1111
let(:params) do
1212
{
1313
project: {
@@ -21,14 +21,21 @@
2121

2222
before do
2323
authenticated_in_hydra_as(teacher)
24-
mock_phrase_generation
24+
mock_phrase_generation(generated_identifier)
2525
end
2626

2727
it 'responds 201 Created' do
2828
post('/api/projects', headers:, params:)
2929
expect(response).to have_http_status(:created)
3030
end
3131

32+
it 'generates an identifier for the project' do
33+
post('/api/projects', headers:, params:)
34+
data = JSON.parse(response.body, symbolize_names: true)
35+
36+
expect(data[:identifier]).to eq(generated_identifier)
37+
end
38+
3239
it 'responds with the project JSON' do
3340
post('/api/projects', headers:, params:)
3441
data = JSON.parse(response.body, symbolize_names: true)

0 commit comments

Comments
 (0)