correction home page bad siret error
This commit is contained in:
parent
3898d8f88e
commit
f7fb0f99bf
4 changed files with 15 additions and 8 deletions
|
@ -27,7 +27,7 @@ class DossiersController < ApplicationController
|
|||
redirect_to url_for(controller: :dossiers, action: :show, id: @dossier.id)
|
||||
|
||||
rescue RestClient::ResourceNotFound
|
||||
redirect_to url_for(controller: :start, action: :error_siret)
|
||||
redirect_to url_for(controller: :start, action: :error_siret, procedure_id: params['procedure_id'])
|
||||
rescue ActiveRecord::RecordNotFound
|
||||
redirect_to url_for(controller: :start, action: :error_dossier)
|
||||
end
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
class StartController < ApplicationController
|
||||
def index
|
||||
@procedure_id = params['procedure_id']
|
||||
@procedure = Procedure.find(@procedure_id)
|
||||
get_procedure_infos
|
||||
|
||||
if @procedure.nil?
|
||||
error_procedure
|
||||
|
@ -15,6 +14,7 @@ class StartController < ApplicationController
|
|||
end
|
||||
|
||||
def error_siret
|
||||
get_procedure_infos
|
||||
flash.now.alert = 'Ce SIRET n\'est pas valide'
|
||||
render 'index'
|
||||
end
|
||||
|
@ -28,4 +28,10 @@ class StartController < ApplicationController
|
|||
flash.now.alert = 'Ce dossier n\'existe pas'
|
||||
render 'index'
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def get_procedure_infos
|
||||
@procedure = Procedure.find(params['procedure_id'])
|
||||
end
|
||||
end
|
||||
|
|
|
@ -45,8 +45,8 @@ ActiveRecord::Schema.define(version: 20150922113504) do
|
|||
t.boolean "dossier_termine"
|
||||
t.integer "procedure_id"
|
||||
t.date "date_previsionnelle"
|
||||
t.datetime "created_at", default: '2015-09-22 09:25:29'
|
||||
t.datetime "updated_at", default: '2015-09-22 09:25:29'
|
||||
t.datetime "created_at"
|
||||
t.datetime "updated_at"
|
||||
end
|
||||
|
||||
add_index "dossiers", ["procedure_id"], name: "index_dossiers_on_procedure_id", using: :btree
|
||||
|
@ -108,7 +108,7 @@ ActiveRecord::Schema.define(version: 20150922113504) do
|
|||
t.integer "type_de_piece_justificative_id"
|
||||
end
|
||||
|
||||
add_index "pieces_justificatives", ["type_de_piece_justificative_id"], name: "index_pieces_justificatives_on_type_de_piece_justificative_id", using: :btree
|
||||
add_index "pieces_justificatives", ["type_de_piece_justificative_id"], name: "index_pieces_justificatives_on_type_piece_jointe_id", using: :btree
|
||||
|
||||
create_table "procedures", force: :cascade do |t|
|
||||
t.string "libelle"
|
||||
|
|
|
@ -1,8 +1,9 @@
|
|||
require 'spec_helper'
|
||||
|
||||
RSpec.describe StartController, type: :controller do
|
||||
let!(:procedure) { create(:procedure) }
|
||||
|
||||
describe 'GET #index' do
|
||||
let!(:procedure) { create(:procedure) }
|
||||
before do
|
||||
get :index, procedure_id: procedure
|
||||
end
|
||||
|
@ -28,7 +29,7 @@ RSpec.describe StartController, type: :controller do
|
|||
|
||||
describe 'GET #index with bad SIRET' do
|
||||
before do
|
||||
get :error_siret
|
||||
get :error_siret, procedure_id: procedure
|
||||
end
|
||||
|
||||
it 'returns http success and flash alert is present' do
|
||||
|
|
Loading…
Reference in a new issue