5
0
Fork 0
mirror of https://0xacab.org/sutty/sutty synced 2024-11-15 02:11:42 +00:00

la descripción de los artículos es obligatoria

This commit is contained in:
f 2019-10-17 16:16:30 -03:00
parent 5f6678a33e
commit 74e47274ff
No known key found for this signature in database
GPG key ID: 2AE5A13E321F953D
6 changed files with 29 additions and 9 deletions

View file

@ -74,6 +74,7 @@ SiteService = Struct.new(:site, :usuarie, :params, keyword_init: true) do
post: {
lang: lang,
title: site.licencia.name,
description: I18n.t('sites.form.licencia.title'),
author: %w[Sutty],
permalink: "#{I18n.t('activerecord.models.licencia').downcase}/",
content: CommonMarker.render_html(site.licencia.deed)

View file

@ -296,7 +296,7 @@ en:
url: 'Demo'
licencia: 'Read the license'
licencia:
title: 'License for the site and everything in it'
title: 'License for the site and everything published on it'
url: 'Read the license'
privacidad:
title: 'Privacy policy and code of conduct'

View file

@ -306,7 +306,7 @@ es:
url: 'Demostración'
license: 'Leer la licencia'
licencia:
title: 'Licencia del sitio y todo lo que publiques'
title: 'Licencia del sitio y todo lo publicado'
url: 'Leer la licencia'
privacidad:
title: Políticas de privacidad y código de convivencia

View file

@ -7,7 +7,8 @@ class PostsControllerTest < ActionDispatch::IntegrationTest
@rol = create :rol
@site = @rol.site
@usuarie = @rol.usuarie
@post = @site.posts.build(title: SecureRandom.hex)
@post = @site.posts.build(title: SecureRandom.hex,
description: SecureRandom.hex)
@post.save
@authorization = {
@ -33,6 +34,7 @@ class PostsControllerTest < ActionDispatch::IntegrationTest
params: {
post: {
title: title,
description: title,
date: 2.days.ago.strftime('%F')
}
}
@ -62,8 +64,14 @@ class PostsControllerTest < ActionDispatch::IntegrationTest
test 'se pueden actualizar' do
title = SecureRandom.hex
patch site_post_url(@site, @post.id), headers: @authorization,
params: { post: { title: title } }
patch site_post_url(@site, @post.id),
headers: @authorization,
params: {
post: {
title: title,
description: title
}
}
assert_equal 302, response.status

View file

@ -43,6 +43,7 @@ class EditorTest < ActionDispatch::IntegrationTest
params: {
post: {
title: SecureRandom.hex,
description: SecureRandom.hex,
content: content
}
}
@ -61,6 +62,7 @@ class EditorTest < ActionDispatch::IntegrationTest
params: {
post: {
title: SecureRandom.hex,
description: SecureRandom.hex,
content: trix_orig
}
}

View file

@ -5,7 +5,8 @@ require 'test_helper'
class PostTest < ActiveSupport::TestCase
setup do
@site = create :site
@post = @site.posts.create(title: SecureRandom.hex)
@post = @site.posts.create(title: SecureRandom.hex,
description: SecureRandom.hex)
end
teardown do
@ -65,6 +66,7 @@ class PostTest < ActiveSupport::TestCase
test 'se pueden guardar los cambios' do
title = SecureRandom.hex
@post.title.value = title
@post.description.value = title
@post.categories.value << title
assert @post.save
@ -78,6 +80,7 @@ class PostTest < ActiveSupport::TestCase
assert document.data['categories'].include?(title)
assert_equal title, document.data['title']
assert_equal title, document.data['description']
assert_equal 'post', document.data['layout']
end
end
@ -136,14 +139,16 @@ class PostTest < ActiveSupport::TestCase
end
test 'new?' do
post = @site.posts.build title: SecureRandom.hex
post = @site.posts.build title: SecureRandom.hex,
description: SecureRandom.hex
assert post.new?
assert post.save
assert_not post.new?
end
test 'no podemos pisar otros archivos' do
post = @site.posts.create title: SecureRandom.hex
post = @site.posts.create title: SecureRandom.hex,
description: SecureRandom.hex
@post.slug.value = post.slug.value
@post.date.value = post.date.value
@ -157,6 +162,7 @@ class PostTest < ActiveSupport::TestCase
post = @site.posts.build(layout: :post)
post.title.value = SecureRandom.hex
post.content.value = SecureRandom.hex
post.description.value = SecureRandom.hex
assert post.new?
assert post.save
@ -165,9 +171,12 @@ class PostTest < ActiveSupport::TestCase
test 'se pueden inicializar con valores' do
title = SecureRandom.hex
post = @site.posts.build(title: title, content: title)
post = @site.posts.build(title: title,
description: title,
content: title)
assert_equal title, post.title.value
assert_equal title, post.description.value
assert_equal title, post.content.value
assert post.save
end