mirror of
https://0xacab.org/sutty/sutty
synced 2024-11-24 07:56:21 +00:00
fix: testear más cosas
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
This commit is contained in:
parent
faec2b2004
commit
f1fa0c77fb
2 changed files with 22 additions and 0 deletions
|
@ -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
|
||||
|
|
|
@ -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 } } })
|
||||
|
|
Loading…
Reference in a new issue