mirror of
https://github.com/docusealco/docuseal
synced 2026-11-07 07:22:32 -05:00
add optional shared link to templates
This commit is contained in:
1 parent
c91b4a765b
commit
e77b5fa2c9
21 files changed
+258
-20
No files matched your search
@@ -83,13 +83,15 @@ describe 'Templates API' do
|
||||
end
|
||||
|
||||
describe 'PUT /api/templates' do
|
||||
it 'update a template' do
|
||||
template = create(:template, account:,
|
||||
author:,
|
||||
folder:,
|
||||
external_id: SecureRandom.base58(10),
|
||||
preferences: template_preferences)
|
||||
let(:template) do
|
||||
create(:template, account:,
|
||||
author:,
|
||||
folder:,
|
||||
external_id: SecureRandom.base58(10),
|
||||
preferences: template_preferences)
|
||||
end
|
||||
|
||||
it 'updates a template' do
|
||||
put "/api/templates/#{template.id}", headers: { 'x-auth-token': author.access_token.token }, params: {
|
||||
name: 'Updated Template Name',
|
||||
external_id: '123456'
|
||||
@@ -106,6 +108,24 @@ describe 'Templates API' do
|
||||
updated_at: template.updated_at
|
||||
}.to_json))
|
||||
end
|
||||
|
||||
it "enables the template's shared link" do
|
||||
expect do
|
||||
put "/api/templates/#{template.id}", headers: { 'x-auth-token': author.access_token.token }, params: {
|
||||
shared_link: true
|
||||
}.to_json
|
||||
end.to change { template.reload.shared_link }.from(false).to(true)
|
||||
end
|
||||
|
||||
it "disables the template's shared link" do
|
||||
template.update(shared_link: true)
|
||||
|
||||
expect do
|
||||
put "/api/templates/#{template.id}", headers: { 'x-auth-token': author.access_token.token }, params: {
|
||||
shared_link: false
|
||||
}.to_json
|
||||
end.to change { template.reload.shared_link }.from(true).to(false)
|
||||
end
|
||||
end
|
||||
|
||||
describe 'DELETE /api/templates/:id' do
|
||||
@@ -206,6 +226,7 @@ describe 'Templates API' do
|
||||
name: 'sample-document'
|
||||
}
|
||||
],
|
||||
shared_link: template.shared_link,
|
||||
author_id: author.id,
|
||||
archived_at: nil,
|
||||
created_at: template.created_at,
|
||||
|
||||
Reference in new issue
Block a user