add spec for contract template form
This commit is contained in:
@@ -30,7 +30,7 @@ RSpec.feature 'User manages contract templates', type: :feature do
|
|||||||
fill_in 'Describe other territory', with: 'North America only'
|
fill_in 'Describe other territory', with: 'North America only'
|
||||||
select 'In perpetuity', from: 'Term'
|
select 'In perpetuity', from: 'Term'
|
||||||
select 'None', from: 'Restriction'
|
select 'None', from: 'Restriction'
|
||||||
click_on 'Create Release Template'
|
click_on create_release_template_button
|
||||||
|
|
||||||
expect(page).to have_content(create_contract_template_success_message)
|
expect(page).to have_content(create_contract_template_success_message)
|
||||||
end
|
end
|
||||||
@@ -48,18 +48,30 @@ RSpec.feature 'User manages contract templates', type: :feature do
|
|||||||
fill_in_trix signature_legal_text_field, with: 'LL'
|
fill_in_trix signature_legal_text_field, with: 'LL'
|
||||||
|
|
||||||
expect do
|
expect do
|
||||||
click_on 'Create Release Template'
|
click_on create_release_template_button
|
||||||
end.to change(ContractTemplate, :count).by(1)
|
end.to change(ContractTemplate, :count).by(1)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
scenario 'location release template has a amendment clause field' do
|
||||||
|
visit new_project_contract_template_path(project)
|
||||||
|
|
||||||
|
fill_in 'Name', with: 'My Release Template'
|
||||||
|
select 'Location Release', from: 'Release type'
|
||||||
|
fill_hidden amendment_clause_field, with: 'Amendment clause text'
|
||||||
|
click_on create_release_template_button
|
||||||
|
|
||||||
|
expect(page).to have_content(create_contract_template_success_message)
|
||||||
|
expect(ContractTemplate.last.amendment_clause.body.to_s).to match /Amendment clause text/
|
||||||
|
end
|
||||||
|
|
||||||
scenario 'medical release template has a guardian clause field' do
|
scenario 'medical release template has a guardian clause field' do
|
||||||
visit new_project_contract_template_path(project)
|
visit new_project_contract_template_path(project)
|
||||||
|
|
||||||
fill_in 'Name', with: 'My Release Template'
|
fill_in 'Name', with: 'My Release Template'
|
||||||
select 'Medical Release', from: 'Release type'
|
select 'Medical Release', from: 'Release type'
|
||||||
fill_hidden guardian_clause_field, with: 'Guardian clause text'
|
fill_hidden guardian_clause_field, with: 'Guardian clause text'
|
||||||
click_on 'Create Release Template'
|
click_on create_release_template_button
|
||||||
|
|
||||||
expect(page).to have_content(create_contract_template_success_message)
|
expect(page).to have_content(create_contract_template_success_message)
|
||||||
expect(ContractTemplate.last.guardian_clause.body.to_s).to match /Guardian clause text/
|
expect(ContractTemplate.last.guardian_clause.body.to_s).to match /Guardian clause text/
|
||||||
@@ -78,7 +90,7 @@ RSpec.feature 'User manages contract templates', type: :feature do
|
|||||||
|
|
||||||
fill_in_trix 'contract_template_guardian_clause', with: 'Guardian clause text'
|
fill_in_trix 'contract_template_guardian_clause', with: 'Guardian clause text'
|
||||||
fill_in question_field(1), with: 'How much experience do you have in the industry?'
|
fill_in question_field(1), with: 'How much experience do you have in the industry?'
|
||||||
click_on 'Create Release Template'
|
click_on create_release_template_button
|
||||||
|
|
||||||
expect(page).to have_content(create_contract_template_success_message)
|
expect(page).to have_content(create_contract_template_success_message)
|
||||||
end
|
end
|
||||||
@@ -185,13 +197,13 @@ RSpec.feature 'User manages contract templates', type: :feature do
|
|||||||
|
|
||||||
scenario 'Should not allow negative fees' do
|
scenario 'Should not allow negative fees' do
|
||||||
fill_in 'Fee', with: '-200'
|
fill_in 'Fee', with: '-200'
|
||||||
click_on 'Create Release Template'
|
click_on create_release_template_button
|
||||||
expect(page).not_to have_content(create_contract_template_success_message)
|
expect(page).not_to have_content(create_contract_template_success_message)
|
||||||
end
|
end
|
||||||
|
|
||||||
scenario 'Should not allow fees with more than 9 digits' do
|
scenario 'Should not allow fees with more than 9 digits' do
|
||||||
fill_in 'Fee', with: '9999999999'
|
fill_in 'Fee', with: '9999999999'
|
||||||
click_on 'Create Release Template'
|
click_on create_release_template_button
|
||||||
expect(page).not_to have_content(create_contract_template_success_message)
|
expect(page).not_to have_content(create_contract_template_success_message)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@@ -465,6 +477,10 @@ RSpec.feature 'User manages contract templates', type: :feature do
|
|||||||
'contract_template_guardian_clause_trix_input_contract_template'
|
'contract_template_guardian_clause_trix_input_contract_template'
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def amendment_clause_field
|
||||||
|
'contract_template_amendment_clause_trix_input_contract_template'
|
||||||
|
end
|
||||||
|
|
||||||
def signature_legal_text_field
|
def signature_legal_text_field
|
||||||
'contract_template_signature_legal_text'
|
'contract_template_signature_legal_text'
|
||||||
end
|
end
|
||||||
@@ -516,4 +532,8 @@ RSpec.feature 'User manages contract templates', type: :feature do
|
|||||||
def duplicate_release_name(template_name = '')
|
def duplicate_release_name(template_name = '')
|
||||||
t 'contract_templates.duplicate.name_prefix', template_name: template_name
|
t 'contract_templates.duplicate.name_prefix', template_name: template_name
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def create_release_template_button
|
||||||
|
'Create Release Template'
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
Reference in New Issue
Block a user