5
0
Fork 0
mirror of https://0xacab.org/sutty/sutty synced 2024-11-24 05:06:22 +00:00

fix: testear más cosas
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful

This commit is contained in:
f 2023-10-06 11:18:38 -03:00
parent faec2b2004
commit f1fa0c77fb
No known key found for this signature in database
2 changed files with 22 additions and 0 deletions

View file

@ -9,6 +9,8 @@ end
# Esto es increíblemente difícil de lograr que salga bien!
class MetadataBoolean < MetadataTemplate
include MetadataBooleanConstants
include Metadata::NonIndexableConcern
include Metadata::AlwaysPublicConcern
# Devolver el valor desde el esquema y si no existe, por defecto es
# false

View file

@ -11,10 +11,30 @@ class MetadataBooleanTest < ActiveSupport::TestCase
@metadata = MetadataBoolean.new(site: @site, document: @document, name: @name, type: 'boolean', layout: @layout)
end
def random_value
[true, false].sample
end
test 'se guarda en el encabezado' do
assert @metadata.front_matter?
end
test 'no se puede indexar' do
assert_not @metadata.indexable?
end
test 'nunca es privado' do
assert_not @metadata.private?
end
test 'son false por defecto' do
assert_equal false, @metadata.default_value
end
test 'aunque sean false nunca son considerados vacíos' do
assert_not @metadata.empty?
end
test 'pueden tener un valor por defecto desde el layout' do
[true, false].each do |default|
@layout = build(:layout, site: @site, metadata: { @name => { 'default' => { I18n.locale.to_s => default } } })