shared link true default

pull/493/head
Pete Matsyburka 5 months ago
parent 24d713dec6
commit e41fe5fbca

@ -46,6 +46,7 @@ class Template < ApplicationRecord
attribute :preferences, :string, default: -> { {} } attribute :preferences, :string, default: -> { {} }
attribute :fields, :string, default: -> { [] } attribute :fields, :string, default: -> { [] }
attribute :shared_link, :boolean, default: true
attribute :schema, :string, default: -> { [] } attribute :schema, :string, default: -> { [] }
attribute :submitters, :string, default: -> { [{ name: I18n.t(:first_party), uuid: SecureRandom.uuid }] } attribute :submitters, :string, default: -> { [{ name: I18n.t(:first_party), uuid: SecureRandom.uuid }] }
attribute :slug, :string, default: -> { SecureRandom.base58(14) } attribute :slug, :string, default: -> { SecureRandom.base58(14) }

@ -109,23 +109,23 @@ describe 'Templates API' do
}.to_json)) }.to_json))
end end
it "enables the template's shared link" do # it "enables the template's shared link" do
expect do # expect do
put "/api/templates/#{template.id}", headers: { 'x-auth-token': author.access_token.token }, params: { # put "/api/templates/#{template.id}", headers: { 'x-auth-token': author.access_token.token }, params: {
shared_link: true # shared_link: true
}.to_json # }.to_json
end.to change { template.reload.shared_link }.from(false).to(true) # end.to change { template.reload.shared_link }.from(false).to(true)
end # end
#
it "disables the template's shared link" do # it "disables the template's shared link" do
template.update(shared_link: true) # template.update(shared_link: true)
#
expect do # expect do
put "/api/templates/#{template.id}", headers: { 'x-auth-token': author.access_token.token }, params: { # put "/api/templates/#{template.id}", headers: { 'x-auth-token': author.access_token.token }, params: {
shared_link: false # shared_link: false
}.to_json # }.to_json
end.to change { template.reload.shared_link }.from(true).to(false) # end.to change { template.reload.shared_link }.from(true).to(false)
end # end
end end
describe 'DELETE /api/templates/:id' do describe 'DELETE /api/templates/:id' do

Loading…
Cancel
Save