From e41fe5fbca7cf2c84e523f16d9bd3b6614ba0f59 Mon Sep 17 00:00:00 2001 From: Pete Matsyburka Date: Sun, 1 Jun 2025 13:21:11 +0300 Subject: [PATCH] shared link true default --- app/models/template.rb | 1 + spec/requests/templates_spec.rb | 34 ++++++++++++++++----------------- 2 files changed, 18 insertions(+), 17 deletions(-) diff --git a/app/models/template.rb b/app/models/template.rb index faa9e696..1350f7ca 100644 --- a/app/models/template.rb +++ b/app/models/template.rb @@ -46,6 +46,7 @@ class Template < ApplicationRecord attribute :preferences, :string, default: -> { {} } attribute :fields, :string, default: -> { [] } + attribute :shared_link, :boolean, default: true attribute :schema, :string, default: -> { [] } attribute :submitters, :string, default: -> { [{ name: I18n.t(:first_party), uuid: SecureRandom.uuid }] } attribute :slug, :string, default: -> { SecureRandom.base58(14) } diff --git a/spec/requests/templates_spec.rb b/spec/requests/templates_spec.rb index 7763d8cd..adee1e30 100644 --- a/spec/requests/templates_spec.rb +++ b/spec/requests/templates_spec.rb @@ -109,23 +109,23 @@ describe 'Templates API' do }.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 + # 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