diff --git a/.gitignore b/.gitignore index c1e5e466bd..f92525ca5e 100644 --- a/.gitignore +++ b/.gitignore @@ -32,8 +32,3 @@ # Ignore master key for decrypting credentials and more. /config/master.key - -/app/assets/builds/* -!/app/assets/builds/.keep - -.idea/ diff --git a/Gemfile b/Gemfile index eba5cf4b46..8066f79fb4 100644 --- a/Gemfile +++ b/Gemfile @@ -18,7 +18,7 @@ gem "stimulus-rails" gem "jbuilder" # Use Active Model has_secure_password [https://guides.rubyonrails.org/active_model_basics.html#securepassword] -gem "bcrypt", "~> 3.1.7" +# gem "bcrypt", "~> 3.1.7" # Windows does not include zoneinfo files, so bundle the tzinfo-data gem gem "tzinfo-data", platforms: %i[ windows jruby ] @@ -63,5 +63,3 @@ group :test do gem "database_cleaner" gem "selenium-webdriver" end - -gem "tailwindcss-rails", "~> 4.4" diff --git a/Gemfile.lock b/Gemfile.lock index d13b318d1e..2858d1707c 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -76,7 +76,6 @@ GEM public_suffix (>= 2.0.2, < 7.0) ast (2.4.3) base64 (0.3.0) - bcrypt (3.1.20) bcrypt_pbkdf (1.1.1) benchmark (0.5.0) bigdecimal (3.3.1) @@ -369,14 +368,6 @@ GEM sys-uname (1.4.1) ffi (~> 1.1) memoist3 (~> 1.0.0) - tailwindcss-rails (4.4.0) - railties (>= 7.0.0) - tailwindcss-ruby (~> 4.0) - tailwindcss-ruby (4.1.16) - tailwindcss-ruby (4.1.16-aarch64-linux-gnu) - tailwindcss-ruby (4.1.16-aarch64-linux-musl) - tailwindcss-ruby (4.1.16-x86_64-linux-gnu) - tailwindcss-ruby (4.1.16-x86_64-linux-musl) thor (1.4.0) thruster (0.1.16) thruster (0.1.16-aarch64-linux) @@ -418,7 +409,6 @@ PLATFORMS x86_64-linux-musl DEPENDENCIES - bcrypt (~> 3.1.7) bootsnap brakeman capybara @@ -438,7 +428,6 @@ DEPENDENCIES solid_queue sqlite3 (>= 2.1) stimulus-rails - tailwindcss-rails (~> 4.4) thruster turbo-rails tzinfo-data diff --git a/Procfile.dev b/Procfile.dev deleted file mode 100644 index da151fee94..0000000000 --- a/Procfile.dev +++ /dev/null @@ -1,2 +0,0 @@ -web: bin/rails server -css: bin/rails tailwindcss:watch diff --git a/app/assets/builds/.keep b/app/assets/builds/.keep deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/app/assets/tailwind/application.css b/app/assets/tailwind/application.css deleted file mode 100644 index 1fd5734650..0000000000 --- a/app/assets/tailwind/application.css +++ /dev/null @@ -1,11 +0,0 @@ -@import "tailwindcss"; -@import url('https://fonts.googleapis.com/css2?family=Roboto:ital,wght@0,100..900;1,100..900&display=swap'); - -@theme { - --font-roboto: "Roboto", sans-serif; - - --color-project-purple: #6C2365; - --color-project-green: #22C55E; - --color-project-secondary-green: #86EFAC; - --color-project-background-gray: #DBDBDB; -} \ No newline at end of file diff --git a/app/controllers/home_controller.rb b/app/controllers/home_controller.rb deleted file mode 100644 index 95f29929ca..0000000000 --- a/app/controllers/home_controller.rb +++ /dev/null @@ -1,4 +0,0 @@ -class HomeController < ApplicationController - def index - end -end diff --git a/app/helpers/home_helper.rb b/app/helpers/home_helper.rb deleted file mode 100644 index 23de56ac60..0000000000 --- a/app/helpers/home_helper.rb +++ /dev/null @@ -1,2 +0,0 @@ -module HomeHelper -end diff --git a/app/mailers/user_mailer.rb b/app/mailers/user_mailer.rb deleted file mode 100644 index 7470851785..0000000000 --- a/app/mailers/user_mailer.rb +++ /dev/null @@ -1,7 +0,0 @@ -class UserMailer < ApplicationMailer - def definicao_senha(user) - @user = user - @url = "http://localhost:3000/definicao_senha" #ajustar conforme o necessario - mail(to: @user.email, subject: 'Definição de Senha - Sistema de Gestão') - end -end diff --git a/app/models/MatriculaTurma.rb b/app/models/MatriculaTurma.rb deleted file mode 100644 index 359884ac7e..0000000000 --- a/app/models/MatriculaTurma.rb +++ /dev/null @@ -1,4 +0,0 @@ -class MatriculaTurma < ApplicationRecord - belongs_to :usuario - belongs_to :turma -end diff --git a/app/models/modelo.rb b/app/models/modelo.rb deleted file mode 100644 index 1a058b998e..0000000000 --- a/app/models/modelo.rb +++ /dev/null @@ -1,5 +0,0 @@ -class Modelo < ApplicationRecord - has_many :perguntas - - validates :titulo, presence: true -end diff --git a/app/models/pergunta.rb b/app/models/pergunta.rb deleted file mode 100644 index cbb26f0609..0000000000 --- a/app/models/pergunta.rb +++ /dev/null @@ -1,6 +0,0 @@ -class Pergunta < ApplicationRecord - belongs_to :modelo - - validates :enunciado, presence: true - validates :tipo, presence: true -end diff --git a/app/models/turma.rb b/app/models/turma.rb deleted file mode 100644 index 80fa925bdd..0000000000 --- a/app/models/turma.rb +++ /dev/null @@ -1,6 +0,0 @@ -class Turma < ApplicationRecord - validates :codigo, :nome, :semestre, presence: true - - has_many :matricula_turmas - has_many :usuarios, through: :matricula_turmas -end diff --git a/app/models/user.rb b/app/models/user.rb deleted file mode 100644 index 2e47818df0..0000000000 --- a/app/models/user.rb +++ /dev/null @@ -1,14 +0,0 @@ -class User < ApplicationRecord - has_secure_password - has_many :sessions, dependent: :destroy - has_many :matricula_turmas - has_many :turmas, through: :matricula_turmas - - validates :email_address, presence: true, uniqueness: true - validates :login, presence: true, uniqueness: true - validates :matricula, presence: true, uniqueness: true - validates :nome, presence: true - - normalizes :email_address, with: ->(e) { e.strip.downcase } - normalizes :login, with: ->(l) { l.strip.downcase } -end diff --git a/app/services/sigaa_import_service.rb b/app/services/sigaa_import_service.rb deleted file mode 100644 index ad82709c80..0000000000 --- a/app/services/sigaa_import_service.rb +++ /dev/null @@ -1,142 +0,0 @@ -require 'json' -require 'csv' - -class SigaaImportService - def initialize(file_path) - @file_path = file_path - @results = { - turmas_created: 0, - turmas_updated: 0, - usuarios_created: 0, - usuarios_updated: 0, - errors: [] - } - end - - def process - unless File.exist?(@file_path) - @results[:errors] << "Arquivo não encontrado: #{@file_path}" - return @results - end - - begin - ActiveRecord::Base.transaction do - case File.extname(@file_path).downcase - when '.json' - process_json - when '.csv' - process_csv - else - @results[:errors] << "Formato de arquivo não suportado: #{File.extname(@file_path)}" - end - - if @results[:errors].any? - raise ActiveRecord::Rollback - end - end - rescue JSON::ParserError - @results[:errors] << "Arquivo JSON inválido" - rescue ActiveRecord::StatementInvalid => e - @results[:errors] << "Erro de conexão com o banco de dados: #{e.message}" - rescue StandardError => e - @results[:errors] << "Erro inesperado: #{e.message}" - end - - @results - end - - private - - def process_json - file_content = File.read(@file_path) - data = JSON.parse(file_content) - data.each do |turma_data| - process_turma(turma_data) - end - end - - def process_csv - CSV.foreach(@file_path, headers: true, col_sep: ',') do |row| - # Assumindo estrutura do CSV - turma_data = { - 'codigo' => row['codigo_turma'], - 'nome' => row['nome_turma'], - 'semestre' => row['semestre'] - } - - turma = process_turma_record(turma_data) - - if turma&.persisted? - user_data = { - 'nome' => row['nome_usuario'], - 'email' => row['email'], - 'matricula' => row['matricula'], - 'papel' => row['papel'] - } - process_participante_single(turma, user_data) - end - end - end - - def process_turma(data) - turma = process_turma_record(data) - if turma&.persisted? - process_participantes(turma, data['participantes']) if data['participantes'] - end - end - - def process_turma_record(data) - turma = Turma.find_or_initialize_by(codigo: data['codigo'], semestre: data['semestre']) - - is_new_record = turma.new_record? - turma.nome = data['nome'] - - if turma.save - if is_new_record - @results[:turmas_created] += 1 - else - @results[:turmas_updated] += 1 - end - turma - else - @results[:errors] << "Erro ao salvar turma #{data['codigo']}: #{turma.errors.full_messages.join(', ')}" - nil - end - end - - def process_participantes(turma, participantes_data) - participantes_data.each do |p_data| - process_participante_single(turma, p_data) - end - end - - def process_participante_single(turma, p_data) - # Usuario identificado pela matrícula - user = User.find_or_initialize_by(matricula: p_data['matricula']) - - is_new_user = user.new_record? - user.nome = p_data['nome'] - user.email = p_data['email'] - - generated_password = nil - if is_new_user - generated_password = SecureRandom.hex(8) - user.password = generated_password - end - - if user.save - if is_new_user - @results[:usuarios_created] += 1 - UserMailer.cadastro_email(user, generated_password).deliver_now - else - @results[:usuarios_updated] += 1 - end - - matricula = MatriculaTurma.find_or_initialize_by(turma: turma, user: user) - matricula.papel = p_data['papel'] - matricula.save! - else - @results[:errors] << "Erro ao salvar usuário #{p_data['matricula']}: #{user.errors.full_messages.join(', ')}" - end - end -end diff --git a/app/views/home/index.html.erb b/app/views/home/index.html.erb deleted file mode 100644 index ea851aba58..0000000000 --- a/app/views/home/index.html.erb +++ /dev/null @@ -1,4 +0,0 @@ -
-

Home#index

-

Find me in app/views/home/index.html.erb

-
diff --git a/app/views/layouts/application.html.erb b/app/views/layouts/application.html.erb index efdc7bf532..7aec90c4ff 100644 --- a/app/views/layouts/application.html.erb +++ b/app/views/layouts/application.html.erb @@ -10,24 +10,19 @@ <%= yield :head %> + <%# Enable PWA manifest for installable apps (make sure to enable in config/routes.rb too!) %> + <%#= tag.link rel: "manifest", href: pwa_manifest_path(format: :json) %> + - <%= stylesheet_link_tag "tailwind", "data-turbo-track": "reload" %> - + <%# Includes all stylesheet files in app/assets/stylesheets %> + <%= stylesheet_link_tag :app, "data-turbo-track": "reload" %> <%= javascript_importmap_tags %> - <%# Remover o comentário para verificar o funcionamento do tailwind - Remover essa parte quando alguma tela for implementada %> - <%#
- Tailwind funcionando -
%> - -
- <%= yield %> -
+ <%= yield %> - \ No newline at end of file + diff --git a/bin/dev b/bin/dev index ad72c7d53c..5f91c20545 100755 --- a/bin/dev +++ b/bin/dev @@ -1,16 +1,2 @@ -#!/usr/bin/env sh - -if ! gem list foreman -i --silent; then - echo "Installing foreman..." - gem install foreman -fi - -# Default to port 3000 if not specified -export PORT="${PORT:-3000}" - -# Let the debug gem allow remote connections, -# but avoid loading until `debugger` is called -export RUBY_DEBUG_OPEN="true" -export RUBY_DEBUG_LAZY="true" - -exec foreman start -f Procfile.dev "$@" +#!/usr/bin/env ruby +exec "./bin/rails", "server", *ARGV diff --git a/config/environments/development.rb b/config/environments/development.rb index cb09d46ec1..1a0bf09e40 100644 --- a/config/environments/development.rb +++ b/config/environments/development.rb @@ -2,8 +2,8 @@ Rails.application.configure do # Configure 'rails notes' to inspect Cucumber files - config.annotations.register_directories("features") - config.annotations.register_extensions("feature") { |tag| /#\s*(#{tag}):?\s*(.*)$/ } + config.annotations.register_directories('features') + config.annotations.register_extensions('feature') { |tag| /#\s*(#{tag}):?\s*(.*)$/ } # Settings specified here will take precedence over those in config/application.rb. @@ -35,11 +35,13 @@ # Store uploaded files on the local file system (see config/storage.yml for options). config.active_storage.service = :local - # Email configuration - config.action_mailer.raise_delivery_errors = true - config.action_mailer.perform_deliveries = true - config.action_mailer.delivery_method = :letter_opener + # Don't care if the mailer can't send. + config.action_mailer.raise_delivery_errors = false + + # Make template changes take effect immediately. config.action_mailer.perform_caching = false + + # Set localhost to be used by links generated in mailer templates. config.action_mailer.default_url_options = { host: "localhost", port: 3000 } # Print deprecation notices to the Rails logger. diff --git a/config/environments/test.rb b/config/environments/test.rb index 29d195b837..e6b5c1b020 100644 --- a/config/environments/test.rb +++ b/config/environments/test.rb @@ -5,8 +5,8 @@ Rails.application.configure do # Configure 'rails notes' to inspect Cucumber files - config.annotations.register_directories("features") - config.annotations.register_extensions("feature") { |tag| /#\s*(#{tag}):?\s*(.*)$/ } + config.annotations.register_directories('features') + config.annotations.register_extensions('feature') { |tag| /#\s*(#{tag}):?\s*(.*)$/ } # Settings specified here will take precedence over those in config/application.rb. diff --git a/config/initializers/inflections.rb b/config/initializers/inflections.rb index e49ae88234..3860f659ea 100644 --- a/config/initializers/inflections.rb +++ b/config/initializers/inflections.rb @@ -11,7 +11,6 @@ # end # These inflection rules are supported but not enabled by default: -ActiveSupport::Inflector.inflections(:en) do |inflect| - inflect.irregular "pergunta", "perguntas" - # inflect.acronym "RESTful" -end +# ActiveSupport::Inflector.inflections(:en) do |inflect| +# inflect.acronym "RESTful" +# end diff --git a/config/routes.rb b/config/routes.rb index f47abe746e..48254e88ed 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -1,5 +1,4 @@ Rails.application.routes.draw do - get "home/index" # Define your application routes per the DSL in https://guides.rubyonrails.org/routing.html # Reveal health status on /up that returns 200 if the app boots with no exceptions, otherwise 500. @@ -11,5 +10,5 @@ # get "service-worker" => "rails/pwa#service_worker", as: :pwa_service_worker # Defines the root path route ("/") - root "home#index" + # root "posts#index" end diff --git a/config/tailwind.config.js b/config/tailwind.config.js deleted file mode 100644 index 04513de24c..0000000000 --- a/config/tailwind.config.js +++ /dev/null @@ -1,27 +0,0 @@ -const defaultTheme = require('tailwindcss/defaultTheme') - -module.exports = { - content: [ - './app/views/**/*.html.erb', - './app/helpers/**/*.rb', - './app/assets/stylesheets/**/*.css', - './app/javascript/**/*.js' - ], - theme: { - extend: { - colors: { - // Verificar se as cores estão corretas - primary: '#1D4ED8', // Azul institucional - secondary: '#9333EA', // Roxo secundário - danger: '#DC2626', // Vermelho de erro - success: '#16A34A', // Verde de sucesso - background: '#F3F4F6' // Cinza claro de fundo - }, - fontFamily: { - // Especificar a fonte - sans: ['Inter', 'sans-serif'], - }, - }, - }, - plugins: [], -} \ No newline at end of file diff --git a/db/migrate/20231026000001_create_turmas.rb b/db/migrate/20231026000001_create_turmas.rb deleted file mode 100644 index e17bb1e0c7..0000000000 --- a/db/migrate/20231026000001_create_turmas.rb +++ /dev/null @@ -1,11 +0,0 @@ -class CreateTurmas < ActiveRecord::Migration[7.0] - def change - create_table :turmas do |t| - t.string :codigo - t.string :nome - t.string :semestre - - t.timestamps - end - end -end diff --git a/db/migrate/20231026000002_create_matricula_turmas.rb b/db/migrate/20231026000002_create_matricula_turmas.rb deleted file mode 100644 index f5d452d96d..0000000000 --- a/db/migrate/20231026000002_create_matricula_turmas.rb +++ /dev/null @@ -1,11 +0,0 @@ -class CreateMatriculaTurmas < ActiveRecord::Migration[7.0] - def change - create_table :matricula_turmas do |t| - t.references :usuario, null: false, foreign_key: true - t.references :turma, null: false, foreign_key: true - t.string :papel - - t.timestamps - end - end -end diff --git a/db/migrate/20251207024056_create_usuarios.rb b/db/migrate/20251207024056_create_usuarios.rb deleted file mode 100644 index a6ded7aea3..0000000000 --- a/db/migrate/20251207024056_create_usuarios.rb +++ /dev/null @@ -1,19 +0,0 @@ -class CreateUsuarios < ActiveRecord::Migration[8.0] - def change - create_table :usuarios do |t| - t.string :login - t.string :matricula - t.string :nome - t.string :email - t.string :formacao - t.string :password_digest - t.boolean :eh_admin, default: false - - t.timestamps - end - - add_index :usuarios, :login, unique: true - add_index :usuarios, :matricula, unique: true - add_index :usuarios, :email, unique: true - end -end diff --git a/db/migrate/20251207035036_create_modelos.rb b/db/migrate/20251207035036_create_modelos.rb deleted file mode 100644 index 9b17ed3c5b..0000000000 --- a/db/migrate/20251207035036_create_modelos.rb +++ /dev/null @@ -1,10 +0,0 @@ -class CreateModelos < ActiveRecord::Migration[8.0] - def change - create_table :modelos do |t| - t.string :titulo - t.boolean :ativo, default: true - - t.timestamps - end - end -end diff --git a/db/migrate/20251207041731_create_perguntas.rb b/db/migrate/20251207041731_create_perguntas.rb deleted file mode 100644 index f0a27b2525..0000000000 --- a/db/migrate/20251207041731_create_perguntas.rb +++ /dev/null @@ -1,12 +0,0 @@ -class CreatePerguntas < ActiveRecord::Migration[8.0] - def change - create_table :perguntas do |t| - t.text :enunciado - t.string :tipo - t.json :opcoes - t.references :modelo, null: false, foreign_key: true - - t.timestamps - end - end -end diff --git a/db/schema.rb b/db/schema.rb deleted file mode 100644 index 2adde0bd2a..0000000000 --- a/db/schema.rb +++ /dev/null @@ -1,47 +0,0 @@ -# This file is auto-generated from the current state of the database. Instead -# of editing this file, please use the migrations feature of Active Record to -# incrementally modify your database, and then regenerate this schema definition. -# -# This file is the source Rails uses to define your schema when running `bin/rails -# db:schema:load`. When creating a new database, `bin/rails db:schema:load` tends to -# be faster and is potentially less error prone than running all of your -# migrations from scratch. Old migrations may fail to apply correctly if those -# migrations use external dependencies or application code. -# -# It's strongly recommended that you check this file into your version control system. - -ActiveRecord::Schema[8.0].define(version: 2025_12_07_041731) do - create_table "modelos", force: :cascade do |t| - t.string "titulo" - t.boolean "ativo", default: true - t.datetime "created_at", null: false - t.datetime "updated_at", null: false - end - - create_table "perguntas", force: :cascade do |t| - t.text "enunciado" - t.string "tipo" - t.json "opcoes" - t.integer "modelo_id", null: false - t.datetime "created_at", null: false - t.datetime "updated_at", null: false - t.index ["modelo_id"], name: "index_perguntas_on_modelo_id" - end - - create_table "usuarios", force: :cascade do |t| - t.string "login" - t.string "matricula" - t.string "nome" - t.string "email" - t.string "formacao" - t.string "password_digest" - t.boolean "eh_admin", default: false - t.datetime "created_at", null: false - t.datetime "updated_at", null: false - t.index ["email"], name: "index_usuarios_on_email", unique: true - t.index ["login"], name: "index_usuarios_on_login", unique: true - t.index ["matricula"], name: "index_usuarios_on_matricula", unique: true - end - - add_foreign_key "perguntas", "modelos" -end diff --git a/lib/tasks/cucumber.rake b/lib/tasks/cucumber.rake index b790c4d483..0caa4d2553 100644 --- a/lib/tasks/cucumber.rake +++ b/lib/tasks/cucumber.rake @@ -5,45 +5,46 @@ # files. -unless ARGV.any? { |a| a =~ /^gems/ } # Don't load anything when running the gems:* tasks +unless ARGV.any? {|a| a =~ /^gems/} # Don't load anything when running the gems:* tasks vendored_cucumber_bin = Dir["#{Rails.root}/vendor/{gems,plugins}/cucumber*/bin/cucumber"].first -$LOAD_PATH.unshift(File.dirname(vendored_cucumber_bin) + "/../lib") unless vendored_cucumber_bin.nil? +$LOAD_PATH.unshift(File.dirname(vendored_cucumber_bin) + '/../lib') unless vendored_cucumber_bin.nil? begin - require "cucumber/rake/task" + require 'cucumber/rake/task' namespace :cucumber do - Cucumber::Rake::Task.new({ ok: "test:prepare" }, "Run features that should pass") do |t| + Cucumber::Rake::Task.new({ok: 'test:prepare'}, 'Run features that should pass') do |t| t.binary = vendored_cucumber_bin # If nil, the gem's binary is used. t.fork = true # You may get faster startup if you set this to false - t.profile = "default" + t.profile = 'default' end - Cucumber::Rake::Task.new({ wip: "test:prepare" }, "Run features that are being worked on") do |t| + Cucumber::Rake::Task.new({wip: 'test:prepare'}, 'Run features that are being worked on') do |t| t.binary = vendored_cucumber_bin t.fork = true # You may get faster startup if you set this to false - t.profile = "wip" + t.profile = 'wip' end - Cucumber::Rake::Task.new({ rerun: "test:prepare" }, "Record failing features and run only them if any exist") do |t| + Cucumber::Rake::Task.new({rerun: 'test:prepare'}, 'Record failing features and run only them if any exist') do |t| t.binary = vendored_cucumber_bin t.fork = true # You may get faster startup if you set this to false - t.profile = "rerun" + t.profile = 'rerun' end - desc "Run all features" - task all: [ :ok, :wip ] + desc 'Run all features' + task all: [:ok, :wip] task :statsetup do - require "rails/code_statistics" - ::STATS_DIRECTORIES << %w[Cucumber\ features features] if File.exist?("features") - ::CodeStatistics::TEST_TYPES << "Cucumber features" if File.exist?("features") + require 'rails/code_statistics' + ::STATS_DIRECTORIES << %w(Cucumber\ features features) if File.exist?('features') + ::CodeStatistics::TEST_TYPES << "Cucumber features" if File.exist?('features') end + end - desc "Alias for cucumber:ok" - task cucumber: "cucumber:ok" + desc 'Alias for cucumber:ok' + task cucumber: 'cucumber:ok' task default: :cucumber @@ -52,16 +53,16 @@ begin end # In case we don't have the generic Rails test:prepare hook, append a no-op task that we can depend upon. - task "test:prepare" do + task 'test:prepare' do end - task stats: "cucumber:statsetup" - + task stats: 'cucumber:statsetup' + rescue LoadError - desc "cucumber rake task not available (cucumber not installed)" + desc 'cucumber rake task not available (cucumber not installed)' task :cucumber do - abort "Cucumber rake task is not available. Be sure to install cucumber as a gem or plugin" + abort 'Cucumber rake task is not available. Be sure to install cucumber as a gem or plugin' end end diff --git a/test/controllers/home_controller_test.rb b/test/controllers/home_controller_test.rb deleted file mode 100644 index f6f3785e82..0000000000 --- a/test/controllers/home_controller_test.rb +++ /dev/null @@ -1,8 +0,0 @@ -require "test_helper" - -class HomeControllerTest < ActionDispatch::IntegrationTest - test "should get index" do - get home_index_url - assert_response :success - end -end diff --git a/test/fixtures/modelos.yml b/test/fixtures/modelos.yml deleted file mode 100644 index 0a27a525e1..0000000000 --- a/test/fixtures/modelos.yml +++ /dev/null @@ -1,9 +0,0 @@ -# Read about fixtures at https://api.rubyonrails.org/classes/ActiveRecord/FixtureSet.html - -one: - titulo: "Modelo de Prova A" - ativo: true - -two: - titulo: "Modelo de Prova B" - ativo: false \ No newline at end of file diff --git a/test/fixtures/perguntas.yml b/test/fixtures/perguntas.yml deleted file mode 100644 index 9f7640b9cd..0000000000 --- a/test/fixtures/perguntas.yml +++ /dev/null @@ -1,13 +0,0 @@ -# Read about fixtures at https://api.rubyonrails.org/classes/ActiveRecord/FixtureSet.html - -one: - enunciado: "Quanto é 1 + 1?" - tipo: "multipla_escolha" - opcoes: {} - modelo: one - -two: - enunciado: "Descreva o sistema solar." - tipo: "dissertativa" - opcoes: {} - modelo: two diff --git a/test/fixtures/usuarios.yml b/test/fixtures/usuarios.yml deleted file mode 100644 index 9c656bbd76..0000000000 --- a/test/fixtures/usuarios.yml +++ /dev/null @@ -1,19 +0,0 @@ -# Read about fixtures at https://api.rubyonrails.org/classes/ActiveRecord/FixtureSet.html - -one: - login: "usuario_teste_1" - matricula: "00001" - nome: "Teste Um" - email: "teste1@exemplo.com" - formacao: "Engenharia" - password_digest: <%= BCrypt::Password.create('minhasenha') %> - eh_admin: false - -two: - login: "usuario_teste_2" - matricula: "00002" - nome: "Teste Dois" - email: "teste2@exemplo.com" - formacao: "Computacao" - password_digest: <%= BCrypt::Password.create('minhasenha2') %> - eh_admin: false diff --git a/test/mailers/application_mailer_test.rb b/test/mailers/application_mailer_test.rb deleted file mode 100644 index 839170acf5..0000000000 --- a/test/mailers/application_mailer_test.rb +++ /dev/null @@ -1,7 +0,0 @@ -require "test_helper" - -class application_mailerTest < ActiveSupport::TestCase - # test "the truth" do - # assert true - # end -end diff --git a/test/mailers/user_mailer_test.rb b/test/mailers/user_mailer_test.rb deleted file mode 100644 index 594b3816c6..0000000000 --- a/test/mailers/user_mailer_test.rb +++ /dev/null @@ -1,7 +0,0 @@ -require "test_helper" - -class user_mailerTest < ActiveSupport::TestCase - # test "the truth" do - # assert true - # end -end diff --git a/test/models/MatriculaTurma_test.rb b/test/models/MatriculaTurma_test.rb deleted file mode 100644 index dd85e3ba9a..0000000000 --- a/test/models/MatriculaTurma_test.rb +++ /dev/null @@ -1,7 +0,0 @@ -require "test_helper" - -class MatriculaTurmaTest < ActiveSupport::TestCase - # test "the truth" do - # assert true - # end -end diff --git a/test/models/modelo_test.rb b/test/models/modelo_test.rb deleted file mode 100644 index 8569835063..0000000000 --- a/test/models/modelo_test.rb +++ /dev/null @@ -1,7 +0,0 @@ -require "test_helper" - -class ModeloTest < ActiveSupport::TestCase - # test "the truth" do - # assert true - # end -end diff --git a/test/models/pergunta_test.rb b/test/models/pergunta_test.rb deleted file mode 100644 index ab2d2e70a8..0000000000 --- a/test/models/pergunta_test.rb +++ /dev/null @@ -1,7 +0,0 @@ -require "test_helper" - -class PerguntaTest < ActiveSupport::TestCase - # test "the truth" do - # assert true - # end -end diff --git a/test/models/turma_test.rb b/test/models/turma_test.rb deleted file mode 100644 index a6cc458ed7..0000000000 --- a/test/models/turma_test.rb +++ /dev/null @@ -1,7 +0,0 @@ -require "test_helper" - -class turmaTest < ActiveSupport::TestCase - # test "the truth" do - # assert true - # end -end diff --git a/test/models/usuario_test.rb b/test/models/usuario_test.rb deleted file mode 100644 index 8cc15a9373..0000000000 --- a/test/models/usuario_test.rb +++ /dev/null @@ -1,21 +0,0 @@ -require "test_helper" - -class UsuarioTest < ActiveSupport::TestCase - test "usuario valido deve ser salvo" do - usuario = Usuario.new( - login: "teste_unitario", - email: "teste@unitario.com", - matricula: "999999", - nome: "Joao Teste", - formacao: "Engenharia", - password: "senha123", - eh_admin: false - ) - assert usuario.save, "Nao salvou o usuario valido" - end - - test "nao deve salvar usuario sem login" do - usuario = Usuario.new(email: "sem_login@teste.com", password: "123") - assert_not usuario.save, "Salvou usuario sem login" - end -end diff --git a/test/services/sigaa_import_service_test.rb b/test/services/sigaa_import_service_test.rb deleted file mode 100644 index dd83ccecea..0000000000 --- a/test/services/sigaa_import_service_test.rb +++ /dev/null @@ -1,65 +0,0 @@ -require 'test_helper' - -class SigaaImportServiceTest < ActiveSupport::TestCase - def setup - @file_path = Rails.root.join('tmp', 'sigaa_data.json') - @data = [ - { - "codigo" => "TURMA123", - "nome" => "Engenharia de Software", - "semestre" => "2023.2", - "participantes" => [ - { - "nome" => "João Silva", - "email" => "joao@example.com", - "matricula" => "2023001", - "papel" => "discente" - } - ] - } - ] - File.write(@file_path, @data.to_json) - end - - def teardown - File.delete(@file_path) if File.exist?(@file_path) - end - - test "importa turmas e usuarios com sucesso" do - assert_difference 'ActionMailer::Base.deliveries.size', 1 do - service = SigaaImportService.new(@file_path) - result = service.process - - assert_empty result[:errors] - assert_equal 1, result[:turmas_created] - assert_equal 1, result[:usuarios_created] - end - - turma = Turma.find_by(codigo: "TURMA123") - assert_not_nil turma - assert_equal "Engenharia de Software", turma.nome - - user = User.find_by(matricula: "2023001") - assert_not_nil user - assert_equal "João Silva", user.nome - assert user.authenticate(user.password) if user.respond_to?(:authenticate) # Optional verification if has_secure_password - - matricula = MatriculaTurma.find_by(turma: turma, user: user) - assert_not_nil matricula - assert_equal "discente", matricula.papel - end - - test "reverte em caso de erro de validação" do - # Criar dados inválidos (semestre faltando para Turma) - invalid_data = @data.dup - invalid_data[0]["semestre"] = nil - File.write(@file_path, invalid_data.to_json) - - service = SigaaImportService.new(@file_path) - result = service.process - - assert_not_empty result[:errors] - assert_equal 0, Turma.count - assert_equal 0, User.count - end -end