From 74e47274ff4dffeee51af0f2043c152e46767c49 Mon Sep 17 00:00:00 2001 From: f Date: Thu, 17 Oct 2019 16:16:30 -0300 Subject: [PATCH] =?UTF-8?q?la=20descripci=C3=B3n=20de=20los=20art=C3=ADcul?= =?UTF-8?q?os=20es=20obligatoria?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/services/site_service.rb | 1 + config/locales/en.yml | 2 +- config/locales/es.yml | 2 +- test/controllers/posts_controller_test.rb | 14 +++++++++++--- test/integration/editor_test.rb | 2 ++ test/models/post_test.rb | 17 +++++++++++++---- 6 files changed, 29 insertions(+), 9 deletions(-) diff --git a/app/services/site_service.rb b/app/services/site_service.rb index 8c94669c..ca0a774d 100644 --- a/app/services/site_service.rb +++ b/app/services/site_service.rb @@ -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) diff --git a/config/locales/en.yml b/config/locales/en.yml index d660955c..009980aa 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -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' diff --git a/config/locales/es.yml b/config/locales/es.yml index 7fdeff7a..d76a2bbe 100644 --- a/config/locales/es.yml +++ b/config/locales/es.yml @@ -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 diff --git a/test/controllers/posts_controller_test.rb b/test/controllers/posts_controller_test.rb index 10a2db19..ff0dd9fe 100644 --- a/test/controllers/posts_controller_test.rb +++ b/test/controllers/posts_controller_test.rb @@ -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 diff --git a/test/integration/editor_test.rb b/test/integration/editor_test.rb index 63c8d5af..95f42c93 100644 --- a/test/integration/editor_test.rb +++ b/test/integration/editor_test.rb @@ -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 } } diff --git a/test/models/post_test.rb b/test/models/post_test.rb index 996a0263..7b903b6a 100644 --- a/test/models/post_test.rb +++ b/test/models/post_test.rb @@ -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