diff --git a/app/decorators/dossier_decorator.rb b/app/decorators/dossier_decorator.rb index 281c7b9c9..9a656e35b 100644 --- a/app/decorators/dossier_decorator.rb +++ b/app/decorators/dossier_decorator.rb @@ -17,7 +17,7 @@ class DossierDecorator < Draper::Decorator 'Brouillon' when 'submitted' 'Soumis' - when 'reply' + when 'replied' 'Répondu' when 'updated' 'Mis à jour' diff --git a/app/models/dossier.rb b/app/models/dossier.rb index 6e92efbb2..2d0267be5 100644 --- a/app/models/dossier.rb +++ b/app/models/dossier.rb @@ -1,7 +1,7 @@ class Dossier < ActiveRecord::Base enum state: {draft: 'draft', - submitted: 'submitted', #-proposed - reply: 'reply', #replied + submitted: 'submitted', + replied: 'replied', #replied updated: 'updated', confirmed: 'confirmed', #validated deposited: 'deposited', #submit_confirmed @@ -49,7 +49,7 @@ class Dossier < ActiveRecord::Base end def next_step! role, action - unless %w(submit reply update comment confirme depose process).include?(action) + unless %w(submit replied update comment confirme depose process).include?(action) fail 'action is not valid' end @@ -68,11 +68,11 @@ class Dossier < ActiveRecord::Base deposited! end when 'update' - if reply? + if replied? updated! end when 'comment' - if reply? + if replied? updated! end end @@ -80,14 +80,14 @@ class Dossier < ActiveRecord::Base case action when 'comment' if updated? - reply! + replied! elsif submitted? - reply! + replied! end when 'confirme' if updated? confirmed! - elsif reply? + elsif replied? confirmed! elsif submitted? confirmed! @@ -106,7 +106,7 @@ class Dossier < ActiveRecord::Base end def self.en_attente - Dossier.where("state='reply' OR state='confirmed'").order('updated_at ASC') + Dossier.where("state='replied' OR state='confirmed'").order('updated_at ASC') end def self.termine diff --git a/db/migrate/20151102102747_change_statereply_to_replied.rb b/db/migrate/20151102102747_change_statereply_to_replied.rb new file mode 100644 index 000000000..95ff57a33 --- /dev/null +++ b/db/migrate/20151102102747_change_statereply_to_replied.rb @@ -0,0 +1,5 @@ +class ChangeStatereplyToReplied < ActiveRecord::Migration + def change + Dossier.where(state: 'reply').update_all(state: 'replied') + end +end diff --git a/db/schema.rb b/db/schema.rb index d92bdc01c..cebbc8fdf 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -11,7 +11,7 @@ # # It's strongly recommended that you check this file into your version control system. -ActiveRecord::Schema.define(version: 20151102101616) do +ActiveRecord::Schema.define(version: 20151102102747) do # These are extensions that must be enabled in order to support this database enable_extension "plpgsql" diff --git a/spec/controllers/backoffice/commentaires_controller_spec.rb b/spec/controllers/backoffice/commentaires_controller_spec.rb index 7cb2a4017..31e890bfb 100644 --- a/spec/controllers/backoffice/commentaires_controller_spec.rb +++ b/spec/controllers/backoffice/commentaires_controller_spec.rb @@ -30,7 +30,7 @@ describe Backoffice::CommentairesController, type: :controller do subject { dossier.state } - it {is_expected.to eq('reply')} + it {is_expected.to eq('replied')} end end end diff --git a/spec/controllers/commentaires_controller_spec.rb b/spec/controllers/commentaires_controller_spec.rb index 9e120d3ed..1769f2f75 100644 --- a/spec/controllers/commentaires_controller_spec.rb +++ b/spec/controllers/commentaires_controller_spec.rb @@ -17,10 +17,10 @@ describe Users::CommentairesController, type: :controller do describe 'change dossier state after post a comment' do context 'when user is connected' do - context 'when dossier is at state reply' do + context 'when dossier is at state replied' do before do sign_in dossier.user - dossier.reply! + dossier.replied! post :create, dossier_id: dossier_id, texte_commentaire: texte_commentaire dossier.reload diff --git a/spec/decorators/dossier_decorator_spec.rb b/spec/decorators/dossier_decorator_spec.rb index dc8f974af..234e0740f 100644 --- a/spec/decorators/dossier_decorator_spec.rb +++ b/spec/decorators/dossier_decorator_spec.rb @@ -22,8 +22,8 @@ describe DossierDecorator do expect(subject).to eq('Soumis') end - it 'reply is repondu' do - dossier.reply! + it 'replied is repondu' do + dossier.replied! expect(subject).to eq('Répondu') end diff --git a/spec/features/backoffice/navigate_to_dossier_spec.rb b/spec/features/backoffice/navigate_to_dossier_spec.rb index 23aa23763..0b76c7740 100644 --- a/spec/features/backoffice/navigate_to_dossier_spec.rb +++ b/spec/features/backoffice/navigate_to_dossier_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' feature 'on backoffice page' do let(:procedure) { create(:procedure) } - let!(:dossier) { create(:dossier, :with_user, :with_entreprise, procedure: procedure, state: 'reply') } + let!(:dossier) { create(:dossier, :with_user, :with_entreprise, procedure: procedure, state: 'replied') } before do visit backoffice_path end diff --git a/spec/models/dossier_spec.rb b/spec/models/dossier_spec.rb index 84ac65b5d..a32c85508 100644 --- a/spec/models/dossier_spec.rb +++ b/spec/models/dossier_spec.rb @@ -191,7 +191,7 @@ describe Dossier do context 'when is post a comment' do let(:action) { 'comment' } - it { is_expected.to eq('reply')} + it { is_expected.to eq('replied')} end context 'when is confirmed the dossier' do @@ -202,9 +202,9 @@ describe Dossier do end end - context 'when dossier is at state reply' do + context 'when dossier is at state replied' do before do - dossier.reply! + dossier.replied! end context 'when user is connect' do @@ -232,7 +232,7 @@ describe Dossier do context 'when is post a comment' do let(:action) { 'comment' } - it { is_expected.to eq('reply')} + it { is_expected.to eq('replied')} end context 'when is confirmed the dossier' do @@ -270,7 +270,7 @@ describe Dossier do context 'when is post a comment' do let(:action) { 'comment' } - it { is_expected.to eq('reply')} + it { is_expected.to eq('replied')} end context 'when is confirmed the dossier' do @@ -375,7 +375,7 @@ describe Dossier do let!(:dossier1) { create(:dossier, :with_user, :with_procedure, state: 'draft')} let!(:dossier2) { create(:dossier, :with_user, :with_procedure, state: 'submitted')} let!(:dossier3) { create(:dossier, :with_user, :with_procedure, state: 'submitted')} - let!(:dossier4) { create(:dossier, :with_user, :with_procedure, state: 'reply')} + let!(:dossier4) { create(:dossier, :with_user, :with_procedure, state: 'replied')} let!(:dossier5) { create(:dossier, :with_user, :with_procedure, state: 'updated')} let!(:dossier6) { create(:dossier, :with_user, :with_procedure, state: 'confirmed')} let!(:dossier7) { create(:dossier, :with_user, :with_procedure, state: 'deposited')} diff --git a/spec/views/backoffice/dossiers/show.html.html_spec.rb b/spec/views/backoffice/dossiers/show.html.html_spec.rb index ee21fd0a1..81a4e267e 100644 --- a/spec/views/backoffice/dossiers/show.html.html_spec.rb +++ b/spec/views/backoffice/dossiers/show.html.html_spec.rb @@ -61,9 +61,9 @@ describe 'backoffice/dossiers/show.html.haml', type: :view do end end - context 'when dossier have state reply' do + context 'when dossier have state replied' do before do - dossier.reply! + dossier.replied! render end diff --git a/spec/views/users/recapitulatif/show.html.haml_spec.rb b/spec/views/users/recapitulatif/show.html.haml_spec.rb index f77b96595..9d74271d8 100644 --- a/spec/views/users/recapitulatif/show.html.haml_spec.rb +++ b/spec/views/users/recapitulatif/show.html.haml_spec.rb @@ -64,9 +64,9 @@ describe 'users/recapitulatif/show.html.haml', type: :view do it { expect(rendered).to have_content('Soumis') } end - context 'when dossier state is reply' do + context 'when dossier state is replied' do before do - dossier.reply! + dossier.replied! render end