Merge branch 'develop' of ssh://37.187.249.111:2200/opt/git/tps into develop
Conflicts: db/schema.rb
This commit is contained in:
commit
ca363ca095
6 changed files with 21 additions and 4 deletions
|
@ -9,10 +9,10 @@ class DossiersController < ApplicationController
|
|||
end
|
||||
|
||||
def create
|
||||
|
||||
@etablissement = Etablissement.new(SIADE::EtablissementAdapter.new(siret).to_params)
|
||||
@entreprise = Entreprise.new(SIADE::EntrepriseAdapter.new(siren).to_params)
|
||||
@dossier = Dossier.create
|
||||
@dossier.draft!
|
||||
|
||||
@dossier.procedure = Procedure.find(params['procedure_id'])
|
||||
@dossier.save
|
||||
|
|
|
@ -1,4 +1,12 @@
|
|||
class Dossier < ActiveRecord::Base
|
||||
enum state: { draft: 'draft',
|
||||
submitted: 'submitted',
|
||||
reply: 'reply',
|
||||
updated: 'updated',
|
||||
confirmed: 'confirmed',
|
||||
filed: 'filed',
|
||||
processed: 'processed' }
|
||||
|
||||
has_one :etablissement
|
||||
has_one :entreprise
|
||||
has_one :cerfa
|
||||
|
@ -45,5 +53,4 @@ class Dossier < ActiveRecord::Base
|
|||
build_cerfa
|
||||
true
|
||||
end
|
||||
|
||||
end
|
||||
|
|
6
db/migrate/20150922141000_add_state_to_dossier.rb
Normal file
6
db/migrate/20150922141000_add_state_to_dossier.rb
Normal file
|
@ -0,0 +1,6 @@
|
|||
class AddStateToDossier < ActiveRecord::Migration
|
||||
def change
|
||||
remove_column :dossiers, :dossier_termine
|
||||
add_column :dossiers, :state, :string
|
||||
end
|
||||
end
|
|
@ -11,6 +11,7 @@
|
|||
#
|
||||
# It's strongly recommended that you check this file into your version control system.
|
||||
|
||||
|
||||
ActiveRecord::Schema.define(version: 20150922141232) do
|
||||
|
||||
# These are extensions that must be enabled in order to support this database
|
||||
|
@ -42,11 +43,11 @@ ActiveRecord::Schema.define(version: 20150922141232) do
|
|||
t.string "nom_projet"
|
||||
t.string "montant_projet"
|
||||
t.string "montant_aide_demande"
|
||||
t.boolean "dossier_termine"
|
||||
t.integer "procedure_id"
|
||||
t.date "date_previsionnelle"
|
||||
t.datetime "created_at"
|
||||
t.datetime "updated_at"
|
||||
t.string "state"
|
||||
end
|
||||
|
||||
add_index "dossiers", ["procedure_id"], name: "index_dossiers_on_procedure_id", using: :btree
|
||||
|
|
|
@ -67,6 +67,10 @@ RSpec.describe DossiersController, type: :controller do
|
|||
it 'links procedure to dossier' do
|
||||
expect(Dossier.last.procedure).to eq(Procedure.last)
|
||||
end
|
||||
|
||||
it 'state of dossier is draft' do
|
||||
expect(Dossier.last.state).to eq('draft')
|
||||
end
|
||||
end
|
||||
|
||||
context 'with non existant siret' do
|
||||
|
|
|
@ -10,7 +10,6 @@ describe Dossier do
|
|||
it { is_expected.to have_db_column(:montant_projet) }
|
||||
it { is_expected.to have_db_column(:montant_aide_demande) }
|
||||
it { is_expected.to have_db_column(:date_previsionnelle).of_type(:date) }
|
||||
it { is_expected.to have_db_column(:dossier_termine) }
|
||||
it { is_expected.to have_db_column(:created_at) }
|
||||
it { is_expected.to have_db_column(:updated_at) }
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue