Upstream sync
This commit is contained in:
@@ -30,6 +30,21 @@ RSpec.describe Api::ContractTemplatesController, type: :controller do
|
||||
|
||||
expect(response).to be_successful
|
||||
end
|
||||
|
||||
it 'returns electronic signature legal text when present' do
|
||||
ct = create(:contract_template, name: 'ct1', project_id: project.id)
|
||||
ct.signature_legal_text = "some electronic signature legal text"
|
||||
ct.save
|
||||
|
||||
sign_in_to_api(current_user)
|
||||
get :show, params: { id: ct.id }
|
||||
|
||||
expect(response).to be_successful
|
||||
|
||||
expect(response.body).to include("signature_legal_text")
|
||||
expect(response.body).to include(ct.signature_legal_text.body.as_json)
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
@@ -127,9 +127,16 @@ RSpec.describe Api::SyncController, type: :controller do
|
||||
get :index
|
||||
|
||||
medical_releases = attributes_for_type('medical_releases')
|
||||
|
||||
expect(medical_releases.first).to include('id')
|
||||
end
|
||||
|
||||
it 'contains signature legal text for contract templates' do
|
||||
create_default_data_with_signature_legal_text
|
||||
get :index
|
||||
contract_templates = attributes_for_type('contract_templates')
|
||||
expect(contract_templates.first).to include('signature_legal_text')
|
||||
expect(contract_templates.first['signature_legal_text']).to eq ContractTemplate.first.signature_legal_text.as_json
|
||||
end
|
||||
end
|
||||
|
||||
private
|
||||
@@ -149,6 +156,13 @@ RSpec.describe Api::SyncController, type: :controller do
|
||||
create(:appearance_release, :minor_with_guardian_photo, project: project)
|
||||
end
|
||||
|
||||
def create_default_data_with_signature_legal_text
|
||||
create_default_data
|
||||
ct = create(:contract_template, name: "with signature legal text", project: Project.first)
|
||||
ct.signature_legal_text = "legal text example"
|
||||
ct.save
|
||||
end
|
||||
|
||||
def response_body_json
|
||||
JSON.parse(response.body)
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user