mirror of
https://0xacab.org/sutty/sutty
synced 2024-11-14 23:11:42 +00:00
74 lines
1.2 KiB
Ruby
74 lines
1.2 KiB
Ruby
# frozen_string_literal: true
|
|
|
|
require 'test_helper'
|
|
|
|
class MetadataBooleanTest < ActiveSupport::TestCase
|
|
test 'son false por defecto' do
|
|
site = create :site
|
|
post = site.posts.build
|
|
|
|
assert_equal false, post.draft.value
|
|
|
|
site.destroy
|
|
end
|
|
|
|
test 'pueden ser 0' do
|
|
site = create :site
|
|
post = site.posts.build
|
|
|
|
post.draft.value = '0'
|
|
|
|
assert_equal false, post.draft.value
|
|
|
|
post.save
|
|
|
|
assert_equal false, post.draft.value
|
|
|
|
site.destroy
|
|
end
|
|
|
|
test 'pueden ser 1' do
|
|
site = create :site
|
|
post = site.posts.build
|
|
|
|
post.draft.value = '1'
|
|
|
|
assert_equal true, post.draft.value
|
|
|
|
post.save
|
|
|
|
assert_equal true, post.draft.value
|
|
|
|
site.destroy
|
|
end
|
|
|
|
test 'pueden ser false' do
|
|
site = create :site
|
|
post = site.posts.build
|
|
|
|
post.draft.value = false
|
|
|
|
assert_equal false, post.draft.value
|
|
|
|
post.save
|
|
|
|
assert_equal false, post.draft.value
|
|
|
|
site.destroy
|
|
end
|
|
|
|
test 'pueden ser true' do
|
|
site = create :site
|
|
post = site.posts.build
|
|
|
|
post.draft.value = true
|
|
|
|
assert_equal true, post.draft.value
|
|
|
|
post.save
|
|
|
|
assert_equal true, post.draft.value
|
|
|
|
site.destroy
|
|
end
|
|
end
|