diff --git a/spec/models/administrateur_spec.rb b/spec/models/administrateur_spec.rb index 538417c55..65cc16f5f 100644 --- a/spec/models/administrateur_spec.rb +++ b/spec/models/administrateur_spec.rb @@ -1,22 +1,6 @@ require 'spec_helper' describe Administrateur, type: :model do - describe 'database column' do - it { is_expected.to have_db_column(:email) } - it { is_expected.to have_db_column(:encrypted_password) } - it { is_expected.to have_db_column(:reset_password_token) } - it { is_expected.to have_db_column(:reset_password_sent_at) } - it { is_expected.to have_db_column(:remember_created_at) } - it { is_expected.to have_db_column(:sign_in_count) } - it { is_expected.to have_db_column(:current_sign_in_at) } - it { is_expected.to have_db_column(:last_sign_in_at) } - it { is_expected.to have_db_column(:current_sign_in_ip) } - it { is_expected.to have_db_column(:last_sign_in_ip) } - it { is_expected.to have_db_column(:created_at) } - it { is_expected.to have_db_column(:updated_at) } - it { is_expected.to have_db_column(:api_token) } - end - describe 'assocations' do it { is_expected.to have_and_belong_to_many(:gestionnaires) } it { is_expected.to have_many(:procedures) } diff --git a/spec/models/cerfa_spec.rb b/spec/models/cerfa_spec.rb index 4ea8dd675..f09242b6f 100644 --- a/spec/models/cerfa_spec.rb +++ b/spec/models/cerfa_spec.rb @@ -1,18 +1,6 @@ require 'spec_helper' describe Cerfa do - describe 'database columns' do - it { is_expected.to have_db_column(:content) } - it { is_expected.to have_db_column(:original_filename) } - it { is_expected.to have_db_column(:content_secure_token) } - it { is_expected.to have_db_column(:created_at) } - end - - describe 'associations' do - it { is_expected.to belong_to(:dossier) } - it { is_expected.to belong_to(:user) } - end - describe 'empty?', vcr: { cassette_name: 'models_cerfa_empty' } do subject { create(:cerfa, content: content) } context 'when content exist' do diff --git a/spec/models/champ_shared_example.rb b/spec/models/champ_shared_example.rb index 7dfe6bb1b..e09d2179d 100644 --- a/spec/models/champ_shared_example.rb +++ b/spec/models/champ_shared_example.rb @@ -1,19 +1,4 @@ shared_examples 'champ_spec' do - describe 'database columns' do - it { is_expected.to have_db_column(:value) } - end - - describe 'associations' do - it { is_expected.to belong_to(:dossier) } - it { is_expected.to belong_to(:type_de_champ) } - end - - describe 'delegation' do - it { is_expected.to delegate_method(:libelle).to(:type_de_champ) } - it { is_expected.to delegate_method(:type_champ).to(:type_de_champ) } - it { is_expected.to delegate_method(:order_place).to(:type_de_champ) } - end - describe 'mandatory_and_blank?' do let(:type_de_champ) { TypeDeChamp.new(mandatory: mandatory) } let(:champ) { Champ.new(type_de_champ: type_de_champ, value: value) } diff --git a/spec/models/dossier_spec.rb b/spec/models/dossier_spec.rb index 6d5cfc268..7caa81911 100644 --- a/spec/models/dossier_spec.rb +++ b/spec/models/dossier_spec.rb @@ -3,40 +3,6 @@ require 'spec_helper' describe Dossier do let(:user) { create(:user) } - describe 'database columns' do - it { is_expected.to have_db_column(:autorisation_donnees) } - it { is_expected.to have_db_column(:created_at) } - it { is_expected.to have_db_column(:updated_at) } - it { is_expected.to have_db_column(:state) } - it { is_expected.to have_db_column(:procedure_id) } - it { is_expected.to have_db_column(:user_id) } - end - - describe 'associations' do - it { is_expected.to belong_to(:procedure) } - it { is_expected.to have_many(:pieces_justificatives) } - it { is_expected.to have_many(:champs) } - it { is_expected.to have_many(:commentaires) } - it { is_expected.to have_many(:quartier_prioritaires) } - it { is_expected.to have_many(:cadastres) } - it { is_expected.to have_many(:cerfa) } - it { is_expected.to have_one(:etablissement) } - it { is_expected.to have_one(:entreprise) } - it { is_expected.to have_one(:individual) } - it { is_expected.to belong_to(:user) } - it { is_expected.to have_many(:invites) } - it { is_expected.to have_many(:follows) } - it { is_expected.to have_many(:notifications) } - end - - describe 'delegation' do - it { is_expected.to delegate_method(:siren).to(:entreprise) } - it { is_expected.to delegate_method(:siret).to(:etablissement) } - it { is_expected.to delegate_method(:types_de_piece_justificative).to(:procedure) } - it { is_expected.to delegate_method(:types_de_champ).to(:procedure) } - it { is_expected.to delegate_method(:france_connect_information).to(:user) } - end - describe 'methods' do let(:dossier) { create(:dossier, :with_entreprise, user: user) } diff --git a/spec/models/drop_down_list_spec.rb b/spec/models/drop_down_list_spec.rb index 712e76d59..c75c9c74e 100644 --- a/spec/models/drop_down_list_spec.rb +++ b/spec/models/drop_down_list_spec.rb @@ -1,14 +1,6 @@ require 'spec_helper' describe DropDownList do - describe 'database columns' do - it { is_expected.to have_db_column(:value) } - end - - describe 'associations' do - it { is_expected.to belong_to(:type_de_champ) } - end - let(:dropdownlist) { create :drop_down_list, value: value } describe '#options' do diff --git a/spec/models/entreprise_spec.rb b/spec/models/entreprise_spec.rb index e89a1c558..0a901fb3e 100644 --- a/spec/models/entreprise_spec.rb +++ b/spec/models/entreprise_spec.rb @@ -1,24 +1,4 @@ require 'spec_helper' describe Entreprise do - describe 'databse columns' do - it { is_expected.to have_db_column(:siren) } - it { is_expected.to have_db_column(:capital_social) } - it { is_expected.to have_db_column(:numero_tva_intracommunautaire) } - it { is_expected.to have_db_column(:forme_juridique) } - it { is_expected.to have_db_column(:forme_juridique_code) } - it { is_expected.to have_db_column(:nom_commercial) } - it { is_expected.to have_db_column(:raison_sociale) } - it { is_expected.to have_db_column(:siret_siege_social) } - it { is_expected.to have_db_column(:code_effectif_entreprise) } - it { is_expected.to have_db_column(:date_creation) } - it { is_expected.to have_db_column(:nom) } - it { is_expected.to have_db_column(:prenom) } - end - - describe 'associations' do - it { is_expected.to belong_to(:dossier) } - it { is_expected.to have_one(:etablissement) } - it { is_expected.to have_one(:rna_information) } - end end diff --git a/spec/models/etablissement_spec.rb b/spec/models/etablissement_spec.rb index c89d5ec43..abc982ad4 100644 --- a/spec/models/etablissement_spec.rb +++ b/spec/models/etablissement_spec.rb @@ -1,27 +1,6 @@ require 'spec_helper' describe Etablissement do - describe 'database columns' do - it { is_expected.to have_db_column(:siret) } - it { is_expected.to have_db_column(:siege_social) } - it { is_expected.to have_db_column(:naf) } - it { is_expected.to have_db_column(:libelle_naf) } - it { is_expected.to have_db_column(:adresse) } - it { is_expected.to have_db_column(:numero_voie) } - it { is_expected.to have_db_column(:type_voie) } - it { is_expected.to have_db_column(:nom_voie) } - it { is_expected.to have_db_column(:complement_adresse) } - it { is_expected.to have_db_column(:code_postal) } - it { is_expected.to have_db_column(:localite) } - it { is_expected.to have_db_column(:code_insee_localite) } - end - - describe 'associations' do - it { is_expected.to belong_to(:dossier) } - it { is_expected.to belong_to(:entreprise) } - it { is_expected.to have_many(:exercices) } - end - describe '#geo_adresse' do let(:etablissement) { create(:etablissement) } diff --git a/spec/models/exercice_spec.rb b/spec/models/exercice_spec.rb index cfd6dc798..cf64c6cfc 100644 --- a/spec/models/exercice_spec.rb +++ b/spec/models/exercice_spec.rb @@ -1,13 +1,4 @@ require 'spec_helper' describe Exercice do - describe 'database columns' do - it { is_expected.to have_db_column(:ca) } - it { is_expected.to have_db_column(:dateFinExercice) } - it { is_expected.to have_db_column(:date_fin_exercice_timestamp) } - end - - describe 'associations' do - it { is_expected.to belong_to(:etablissement) } - end end diff --git a/spec/models/france_connect_information_spec.rb b/spec/models/france_connect_information_spec.rb index 2bc10de48..330fc679c 100644 --- a/spec/models/france_connect_information_spec.rb +++ b/spec/models/france_connect_information_spec.rb @@ -1,20 +1,6 @@ require 'spec_helper' describe FranceConnectInformation, type: :model do - describe 'database columns' do - it { is_expected.to have_db_column(:given_name) } - it { is_expected.to have_db_column(:family_name) } - it { is_expected.to have_db_column(:email_france_connect) } - it { is_expected.to have_db_column(:birthdate) } - it { is_expected.to have_db_column(:gender) } - it { is_expected.to have_db_column(:birthplace) } - it { is_expected.to have_db_column(:france_connect_particulier_id) } - end - - describe 'associations' do - it { is_expected.to belong_to(:user) } - end - describe 'validation' do context 'france_connect_particulier_id' do it { is_expected.not_to allow_value(nil).for(:france_connect_particulier_id) } diff --git a/spec/models/gestionnaire_spec.rb b/spec/models/gestionnaire_spec.rb index 200ccb692..18b8461d9 100644 --- a/spec/models/gestionnaire_spec.rb +++ b/spec/models/gestionnaire_spec.rb @@ -13,30 +13,6 @@ describe Gestionnaire, type: :model do create :assign_to, gestionnaire: gestionnaire, procedure: procedure_2 end - describe 'database column' do - it { is_expected.to have_db_column(:email) } - it { is_expected.to have_db_column(:encrypted_password) } - it { is_expected.to have_db_column(:reset_password_token) } - it { is_expected.to have_db_column(:reset_password_sent_at) } - it { is_expected.to have_db_column(:remember_created_at) } - it { is_expected.to have_db_column(:sign_in_count) } - it { is_expected.to have_db_column(:current_sign_in_at) } - it { is_expected.to have_db_column(:last_sign_in_at) } - it { is_expected.to have_db_column(:current_sign_in_ip) } - it { is_expected.to have_db_column(:last_sign_in_ip) } - it { is_expected.to have_db_column(:created_at) } - it { is_expected.to have_db_column(:updated_at) } - end - - describe 'association' do - it { is_expected.to have_one(:preference_smart_listing_page) } - it { is_expected.to have_and_belong_to_many(:administrateurs) } - it { is_expected.to have_many(:procedures) } - it { is_expected.to have_many(:dossiers) } - it { is_expected.to have_many(:follows) } - it { is_expected.to have_many(:preference_list_dossiers) } - end - describe '#toggle_follow_dossier' do let!(:dossier) { create :dossier, procedure: procedure } diff --git a/spec/models/invite_spec.rb b/spec/models/invite_spec.rb index e6c637d69..63978930d 100644 --- a/spec/models/invite_spec.rb +++ b/spec/models/invite_spec.rb @@ -1,15 +1,6 @@ require 'spec_helper' describe Invite do - describe 'database columns' do - it { is_expected.to have_db_column(:email) } - end - - describe 'associations' do - it { is_expected.to belong_to(:dossier) } - it { is_expected.to belong_to(:user) } - end - describe 'an email can be used for multiple dossier' do let(:email1) { 'plop@octo.com' } diff --git a/spec/models/piece_justificative_spec.rb b/spec/models/piece_justificative_spec.rb index 62da2cd96..0cfd6aee2 100644 --- a/spec/models/piece_justificative_spec.rb +++ b/spec/models/piece_justificative_spec.rb @@ -1,20 +1,6 @@ require 'spec_helper' describe PieceJustificative do - describe 'database columns' do - it { is_expected.to have_db_column(:content) } - it { is_expected.to have_db_column(:original_filename) } - it { is_expected.to have_db_column(:content_secure_token) } - it { is_expected.to have_db_column(:created_at) } - end - - describe 'associations' do - it { is_expected.to belong_to(:dossier) } - it { is_expected.to belong_to(:type_de_piece_justificative) } - it { is_expected.to belong_to(:user) } - it { is_expected.to have_one(:commentaire) } - end - describe 'validations' do context 'content' do it { is_expected.not_to allow_value(nil).for(:content) } @@ -22,11 +8,6 @@ describe PieceJustificative do end end - describe 'delegation' do - it { is_expected.to delegate_method(:libelle).to(:type_de_piece_justificative) } - it { is_expected.to delegate_method(:api_entreprise).to(:type_de_piece_justificative) } - end - describe '#empty?', vcr: { cassette_name: 'model_piece_justificative' } do let(:piece_justificative) { create(:piece_justificative, content: content) } subject { piece_justificative.empty? } diff --git a/spec/models/rna_information_spec.rb b/spec/models/rna_information_spec.rb index 807783396..89537c245 100644 --- a/spec/models/rna_information_spec.rb +++ b/spec/models/rna_information_spec.rb @@ -1,16 +1,4 @@ require 'spec_helper' describe RNAInformation do - describe 'databse columns' do - it { is_expected.to have_db_column(:association_id) } - it { is_expected.to have_db_column(:titre) } - it { is_expected.to have_db_column(:objet) } - it { is_expected.to have_db_column(:date_creation) } - it { is_expected.to have_db_column(:date_publication) } - it { is_expected.to have_db_column(:date_declaration) } - end - - describe 'associations' do - it { is_expected.to belong_to(:entreprise) } - end end diff --git a/spec/models/type_de_champ_shared_example.rb b/spec/models/type_de_champ_shared_example.rb index 3ed2e0f0c..fbe3b24de 100644 --- a/spec/models/type_de_champ_shared_example.rb +++ b/spec/models/type_de_champ_shared_example.rb @@ -1,16 +1,4 @@ shared_examples 'type_de_champ_spec' do - describe 'database columns' do - it { is_expected.to have_db_column(:libelle) } - it { is_expected.to have_db_column(:type_champ) } - it { is_expected.to have_db_column(:order_place) } - it { is_expected.to have_db_column(:description) } - end - - describe 'associations' do - it { is_expected.to belong_to(:procedure) } - it { is_expected.to have_many(:champ) } - end - describe 'validation' do context 'libelle' do it { is_expected.not_to allow_value(nil).for(:libelle) } diff --git a/spec/models/type_de_piece_justificative_spec.rb b/spec/models/type_de_piece_justificative_spec.rb index 584c7a555..c6ee609d2 100644 --- a/spec/models/type_de_piece_justificative_spec.rb +++ b/spec/models/type_de_piece_justificative_spec.rb @@ -3,21 +3,6 @@ require 'spec_helper' describe TypeDePieceJustificative do let!(:procedure) { create(:procedure) } - describe 'database columns' do - it { is_expected.to have_db_column(:libelle) } - it { is_expected.to have_db_column(:description) } - it { is_expected.to have_db_column(:api_entreprise) } - it { is_expected.to have_db_column(:created_at) } - it { is_expected.to have_db_column(:updated_at) } - it { is_expected.to have_db_column(:order_place) } - it { is_expected.to have_db_column(:lien_demarche) } - end - - describe 'associations' do - it { is_expected.to have_many(:pieces_justificatives) } - it { is_expected.to belong_to(:procedure) } - end - describe 'validation' do context 'libelle' do it { is_expected.not_to allow_value(nil).for(:libelle) } diff --git a/spec/models/user_spec.rb b/spec/models/user_spec.rb index 552d42bca..58bd78bc2 100644 --- a/spec/models/user_spec.rb +++ b/spec/models/user_spec.rb @@ -1,28 +1,6 @@ require 'spec_helper' describe User, type: :model do - describe 'database columns' do - it { is_expected.to have_db_column(:email) } - it { is_expected.to have_db_column(:encrypted_password) } - it { is_expected.to have_db_column(:reset_password_token) } - it { is_expected.to have_db_column(:reset_password_sent_at) } - it { is_expected.to have_db_column(:remember_created_at) } - it { is_expected.to have_db_column(:sign_in_count) } - it { is_expected.to have_db_column(:current_sign_in_at) } - it { is_expected.to have_db_column(:last_sign_in_at) } - it { is_expected.to have_db_column(:current_sign_in_ip) } - it { is_expected.to have_db_column(:last_sign_in_ip) } - it { is_expected.to have_db_column(:created_at) } - it { is_expected.to have_db_column(:updated_at) } - it { is_expected.to have_db_column(:siret) } - it { is_expected.to have_db_column(:loged_in_with_france_connect) } - end - describe 'associations' do - it { is_expected.to have_many(:dossiers) } - it { is_expected.to have_many(:invites) } - it { is_expected.to have_many(:piece_justificative) } - it { is_expected.to have_many(:cerfa) } - end describe '#find_for_france_connect' do let(:siret) { '00000000000000' } context 'when user exist' do