chore: reorganize para current/, rails 8.1, testes e readme
- move app para current/ (estrutura capistrano) - rails 7.2 → 8.1, ruby 3.2, sqlite3 2.x - adiciona primary_key Idinformativo no model - schema.rb completo com todas as tabelas - testes minitest: models (Tag, Informativo, Tema) e controllers - readme atualizado em pt-br com stack e instruções de desenvolvimento - gitignore exclui dump.sql, *.duckdb e sqlite3
This commit is contained in:
28
current/test/models/informativo_test.rb
Normal file
28
current/test/models/informativo_test.rb
Normal file
@@ -0,0 +1,28 @@
|
||||
require "test_helper"
|
||||
|
||||
class InformativoTest < ActiveSupport::TestCase
|
||||
test "creates with titulo and sets Datainc automatically" do
|
||||
info = Informativo.create!(titulo: "Novo artigo ambiental")
|
||||
assert_not_nil info.Datainc
|
||||
assert_not_nil info.Idinformativo
|
||||
end
|
||||
|
||||
test "does not overwrite an existing Datainc" do
|
||||
date = Date.new(2010, 6, 1)
|
||||
info = Informativo.create!(titulo: "Artigo antigo", Datainc: date)
|
||||
assert_equal date, info.Datainc
|
||||
end
|
||||
|
||||
test "to_html renders markdown column as HTML" do
|
||||
info = Informativo.create!(titulo: "Test", markdown: "## Título\nConteúdo")
|
||||
html = info.to_html
|
||||
assert_includes html, "<h2>"
|
||||
assert_includes html, "Título"
|
||||
end
|
||||
|
||||
test "temas returns matching tema names" do
|
||||
tema = Tema.create!(cod_tema: 7, tema: "Energia", padrao: "Energia Renovável", count: 0)
|
||||
info = Informativo.create!(titulo: "Solar", tema1: 7)
|
||||
assert_includes info.temas, tema.tema
|
||||
end
|
||||
end
|
||||
Reference in New Issue
Block a user