2016-08-08 12:52:30 +02:00
|
|
|
require 'spec_helper'
|
|
|
|
|
|
|
|
describe Backoffice::PrivateFormulairesController, type: :controller do
|
|
|
|
let(:gestionnaire) { create :gestionnaire }
|
2016-12-01 18:05:49 +01:00
|
|
|
let(:dossier) { create :dossier, state: :initiated }
|
2016-08-08 12:52:30 +02:00
|
|
|
let(:dossier_champs_first) { 'plop' }
|
|
|
|
|
|
|
|
before do
|
|
|
|
create :assign_to, procedure_id: dossier.procedure.id, gestionnaire_id: gestionnaire.id
|
|
|
|
|
|
|
|
sign_in gestionnaire
|
|
|
|
end
|
|
|
|
|
|
|
|
describe '#PATCH update' do
|
2016-11-15 04:50:18 +01:00
|
|
|
subject { patch :update,
|
2017-06-12 13:49:51 +02:00
|
|
|
params: {
|
|
|
|
dossier_id: dossier.id,
|
|
|
|
champs: {
|
|
|
|
"'#{dossier.champs_private.first.id}'" => dossier_champs_first
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2016-08-08 12:52:30 +02:00
|
|
|
|
|
|
|
before do
|
|
|
|
subject
|
|
|
|
end
|
|
|
|
|
|
|
|
it { expect(response.status).to eq 200 }
|
|
|
|
it { expect(Dossier.find(dossier.id).champs_private.first.value).to eq dossier_champs_first }
|
|
|
|
it { expect(flash[:notice]).to be_present }
|
|
|
|
end
|
|
|
|
end
|