demarches-normaliennes/spec/controllers/backoffice/private_formulaires_controller_spec.rb
2017-06-13 10:35:16 +02:00

32 lines
835 B
Ruby

require 'spec_helper'
describe Backoffice::PrivateFormulairesController, type: :controller do
let(:gestionnaire) { create :gestionnaire }
let(:dossier) { create :dossier, state: :initiated }
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
subject { patch :update,
params: {
dossier_id: dossier.id,
champs: {
"'#{dossier.champs_private.first.id}'" => dossier_champs_first
}
}
}
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